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

There was a bug with both with the Beta version of VS 2005 and also the Website Administration Tool which caused the above schema attribute to be added to the root “Configuration” tag of the web.config. You can go through the first three References at the bottom of this article for a more detailed description of the problem.

Until now I was under the impression, that this bug only affected VS 2005 Intellisense while editing the web.config. However, recently I encountered another more serious issue which occurred at runtime due to this additional schema tag being present in the web.config. It so happens, that with this tag being present, the “codeBase” hint specified in the web.config does not take any effect on the assembly probing mechanism of the runtime to resolve an assembly reference.

The codeBase hint is typically configured as follows to specify a path for the runtime to probe for referenced files:-

codeBase Hint configuration

In the above example, for the 1.0.0.0 version of the assembly, the codeBase specified the 1.0 folder within the bin folder and for the 1.0.0.1, it specifies the 1.1 folder. That is to say, once the runtime determines the correct assembly version required, it checks if that assembly version has been bound before, checks the global assembly cache successively and if it does not find a match in either, then it looks at the location specified by the codeBase hint.

However, with the additional namespace tag specified in the root “Configuration” tag, the runtime completely ignored the codeBase hint and did not look for the assembly in the specified path even though it could not find the required version of the assembly in the previously bound paths or the GAC. As a result, one of the following two errors would result:-

  1. Could not load file or assembly ‘Assembly1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=76cd4ba45e0a88a1’ or one of its dependencies. System could not find the file.
  2. Could not load file or assembly ‘Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7′ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.

The solution is pretty simple. Just remove the namespace tag from the root “Configuration” tag.

References:-

  1. http://forums.asp.net/p/981068/1359525.aspx
  2. http://groups.google.de/group/microsoft.public.dotnet.framework.aspnet/browse_thread/thread/12152d90b4f6398c/076c50ae9d71f18f?lnk=st&q=web.config+author%3AJooss&rnum=1&hl=de
  3. http://weblogs.asp.net/scottgu/archive/2005/12/02/432077.aspx
  4. http://msdn.microsoft.com/en-us/library/yx7xezcf%28vs.71%29.aspx

One thought on “xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"”

Leave a Reply to Tabitha Cancel reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>