Solved

Am I missing an assembly reference?

Posted on 2003-10-26
6
354 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 4

Expert Comment

by:brother7
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

10 Experts available now in Live!

Get 1:1 Help Now