Parsing web.config with XmlDocument.SelectSingleNode

I have an utility that modified ASP.NET web.config using code like this:

XmlDocument document = new XmlDocument();
document.Load(sConfigFileName);
XmlNode nodeParent = document.SelectSingleNode("/configuration/system.web");

I found that this code doesn't work with VS 2005 (SelectSingleNode returns null) because configuration element has xmlns

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> .

I was able to delete xmlns attribute without any visible side effects to make SelectSingleNode("/configuration/system.web") working .

But it will be probably required to use new classes in Configuration namespace or use XmlNamespaceManager.

I think that Visual XPath source can be a sample for this.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Using VS 2005 Web Setup Project with custom actions

I've used VS 2003 Web Setup Project with custom actions and Installer class. that did some changes.

After moving to VS 2005 I found that it is not possible to invoke custom action for DLL because only content output is available.

The post suggested to use VS 2005 Web Deployment Project .

However in my case compile failed with the very helpful Aspnet_merge.exe Exited With Code 1.   Some posts explain that the error comes from duplicate class names in the project, even if the name comes from different name space. But my code is based on DNN and they use classes with the same name quite extensively.(UPDATE: workaround posted in the post:Use VS 2005 Web Deployment Project with DotNetNuke)

Fortunately a workaround is quite simple.

1. Put Installer class in a separate Class Library(or Windows Executable) Project.

2.Add the installer primary output to the web setup project

3.Specify custom action for the installer primary output.

Update: I've added more comments about Web Setup Project in the post “Using VS 2005 Web Setup Project - not user friendly process.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Namespace can't be shared between 2 assemblies in Visual Studio 2005

I have VB library that references C# library. C# library has a few classes with namespace FSWeb. And a few VB modules called this classes without any problem.

When  I've added to the VB Project a new class with the same namespace specified, the c# classes became invisible in all VB classes for both compiler and intellisence with the errors like:

Error 231 'Search' is not a member of 'FSWeb'. 
Error 230 Type 'FSWeb.LoginHelper' is not defined. 

When I type “FSWeb.” intellisence shows only the class from the current VB assembly.

The workaround is obviously use different namespaces for different assemblies.

I reported this  to  MS as a  bug.

 

 


 

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
2627281234
567891011