Solved

Am I missing an assembly reference?

Posted on 2003-10-26
6
360 Views
Last Modified: 2012-08-13
Hi all. I don't use Visual Studio, only the C# compiler in .NET Framework, on Windows XP. I like to do a small program that uses the XML classes, but I get this error:

vp.cs(3,14): error CS0234: The type or namespace name 'Xml' does not exist in
        the class or namespace 'System' (are you missing an assembly reference?)

And here's the line that is supposed to be in error:

using System.Xml;

Another time, I was acctually able to solve this by adding an explicit reference on the command line, but since I plan to make a lot of small programs like this, I'd rather not have to type this reference every time (and besides, I don't remember how to do it). I guess there's a way to add the reference by using the .NET configuration tools, and that's my question. How?
0
Comment
Question by:liljegren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:brother7
ID: 9624083
You need to add a reference to System.XML.dll to your project.  If you're using the IDE, you can do this from the Solution Explorer... right-click on the project name and choose "Add Reference...".

It wasn't clear what you're using to program.  Are you using the C# IDE or the C# SDK (where everything is compiled from the commandline)?  I'm assuming you have access to the IDE.
0
 
LVL 4

Expert Comment

by:brother7
ID: 9624176
Just in case you are compiling from the commandline, the way to include a reference is:
   csc Project.cs /reference:System.XML.dll
0
 

Author Comment

by:liljegren
ID: 9624377
I compile from the command-line, and the question is if there's a way to make the reference to System.Xml.dll implicit. I've tried to do this in .NET Configuration 1.1, from the Administrative Tools on the Start menu, but haven't been successful.

I can see that System.Xml.dll is in the GAC, but what's needed more than that? I also use the IO module, and have no problem with that one.
0
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 
LVL 4

Expert Comment

by:brother7
ID: 9624561
Hmm... I've been looking and I can't find anything.  My guess would be that you have to include the reference in the commandline.
I'd bet that this even happens when you Build using the IDE... the IDE calls csc.exe and passes the references as commandline arguments.  This is just my guess.
I've been looking around to see where the added references info is kept and I think it is in the Solution.suo file which isn't a viewable text file :(
0
 

Author Comment

by:liljegren
ID: 9624660
Thanks. I'll just wait 1 day to see if there might be an answer after all.
0
 
LVL 1

Accepted Solution

by:
LastResort earned 250 total points
ID: 9627378
Visual studio stores the ref in the propjct file - essentially a makefile.

If you simply create a batch file called 'cscXML.bat' or something that takes the project name as a param you can recreate the functionality you want.

In my opinion you really should look into using sharpdevelop  or web matrix though - your life will become easier.
0

Featured Post

Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question