views:

249

answers:

3

I'm trying to add a reference to the GAC version of System.Xml in a Visual Studio 2008 web site project. I right-click the project icon in the Solution Explorer, and click Property Pages. Under the References tree option, I click the 'Add' button on the right. I navigate to System.Xml in the .NET tab, and double click it (the Path it lists for System.Xml, C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.XML.dll, DOES exist). The dialog disappears, but... System.Xml does not get added as a reference! The list just stays the same.

I tried adding another .NET reference just to make sure others could be added OK, I added System.Web.RegularExpressions and it added fine. What on earth could be causing it not to add System.Xml?

A: 

Try to edit your vbproj file, and add

<Reference Include="System.Xml" />
Rubens Farias
It's an ASP.net Web Site, so it has a Solution file but no vbproj file. :-(
Jez
sorry, I just have vs2008 here; can you right-click project item in solution explorer, select unload project and edit project file?have you tried to add system.xml inside your web.config at system.web/compilation/assemblies node?
Rubens Farias
A: 

Well it looks like it might have had something to do with my trying to add a .cs file to a project where the rest of the files were in vb.net. Hmph, I thought one of the major benefits of .NET was you could easily mix languages. Oh well, I removed that and added these lines into my web.config file:

<add namespace="System.Xml"/>

and

<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

and now it compiles OK. I can access System.Xml from within VB code, so it looks like I'll have to translate the class I had from C# to VB.net. Hmph.

Jez
A: 

Hi, I just created a ASP.NET Website with default language C# & .NET 2.0 as the target. I also observed that even if you try to add a reference to System.XML, you will not find one in the project proprieties page.

As far it goes for me, its as designed.

By default you can access all the default .NET namespaces (in your target version) by just adding "using NAMESPACE_NAME;" in you code behind.(System (& the sub namespaces like XML etc). ASP, Microsoft & MS) Only when you reference a third party .NET dll or something that's not default for an ASP.NET Website project (could not find the list of defaults on the net), then a new folder called bin is created & a copy of that dll is stored in it if it is not in GAC.

EDIT: Regarding not able to add a cs file to vb file, I just did that, & I could access System.Xml namespace in the vb file.

Ganesh R.
*shrug*, I don't know what the problem was in mine then. I never liked the Web Sites, though, I preferred them web application projects. Dumb coworkers for starting Web Site projects. :-)
Jez
try that again. If its a website, just try adding the System.Xml namespace in the code behind. Agreed that you will not see a reference toit in the properties page, but you will be able to add the namcespace using intellisense. And since intellisense shows the namespace it is referenced somewhere.
Ganesh R.