Solved

Am I missing an assembly reference?

Posted on 2003-10-26
6
355 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
  • 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Split string on commas but not when enclosed in parentheses 7 47
Format column on datatable 7 28
Tool Box 2 34
Syntax error 9 45
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:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now