How to stop Visual Studio adding assemblies to my web.config?

Maybe the "Avatar DotNet Library" is referencing those assemblies by itself. The references of a referenced assembly are needed to correctly deploy a project. Otherwise, how could the referenced assembly work?

Note that it's possible that your referenced assembly does not use its own references, although they exists.

Edit: You can use the great tool ".Net Reflector" to check this.


Convert you "Web Site" project to a "Web Application" project.

A "Web Site" does not have a project file, so it contains all assembly references in the web.config. A "Web Project" has a project file, and all references are stored in the project file.


I used VS2005 to edit a .net 1.1 (VS2003) .aspx and saved it, then the web.config will mysteriously have the net. 2.0 assemblies added:

If I used VS2008 or VS2010, this does not happen. So I believe this is is a bug in the VS2005 IDE.


I had this problem with Visual Studio 2005 (but I'm happy to report that the solution works for VS 2008, see bolded text below). There is a registry section that VS checks before it adds assemblies to the web.config file.

Here is the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\FilteredGACReferences

So, let's say you don't want Visual Studio to add the Microsoft.VisualStudio.Designer.Interfaces assembly to your web.config. Add the following entry to your registry and you are set.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\FilteredGACReferences\Microsoft.VisualStudio.Designer.Interfaces

It worked perfectly for me. And yes, the rest of your team will have to do the same, but at least you don't have to manually remove the entries every time :)

To make it work for VS 2008 - just change the 8.0 in the registry path to 9.0