Link to home
Start Free TrialLog in
Avatar of liljegren
liljegrenFlag for Sweden

asked on

Am I missing an assembly reference?

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?
Avatar of brother7
brother7
Flag of United States of America image

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.
Just in case you are compiling from the commandline, the way to include a reference is:
   csc Project.cs /reference:System.XML.dll
Avatar of liljegren

ASKER

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.
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 :(
Thanks. I'll just wait 1 day to see if there might be an answer after all.
ASKER CERTIFIED SOLUTION
Avatar of LastResort
LastResort

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial