Every time i build, or publish, a web-site, Visual Studio attempts to check out the web.config file so that it can add numerous assemblies that are not required.
In other words:
web.config before:
<configuration> <system.web> <compilation> <assemblies> </assemblies> </compilation> </system.web> </configuration>
web.config after:
<configuration> <system.web> <compilation> <assemblies> <add assembly="Microsoft.ReportViewer.Common... /> <add assembly="Microsoft.ReportViewer.WinForms... /> <add assembly="System.DirectoryServices... /> <add assembly="System.Windows.Forms... /> <add assembly="ADODB... /> <add assembly="System.Management... /> <add assembly="System.Data.OracleClient... /> <add assembly="Microsoft.Build.Utilities... /> <add assembly="Microsoft.ReportViewer.ProcessingObjectModel... /> <add assembly="System.Design... /> <add assembly="Microsoft.Build.Framework... /> </assemblies> </compilation> </system.web> </configuration>
None of these assemblies are required, and most don't exist on the target test, or production, servers.
i keep deleting them every time i build, but it's getting real annoying real fast.
Right now my workaround is to leave web.config read-only - so Visual Studio cannot add assemblies to it.
Screenshots as proof:
Project Property Pages before:
Web.Config before:
Project Property Pages after:
Web.config after:
It should be pointed out explicitly that the web-site works without these extraneous references being added. My interim solution is to keep web.config read-only, and hit Cancel whenever Visual Studio complains that it's read-only as it tries to modify it. If i can just stop Visual Studio from trying to modify it in the first place...
It looks like it's not possible. Someone can feel free to give the correct answer, "You cannot stop Visual Studio from adding assemblies to your web.config." and i'll mark it.
The only reason i'm keeping the question up is that hopefully someone knows the super-secret option, or registry key, or project or solution setting, to tell Visual Studio to stop thinking.
i didn't accept the accepted answer, and i'd unaccept it if i could. i'm still hoping for the panacea. But right now i'm leaning towards:
How do i stop Visual Studio from adding assemblies to my web.config?
config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ folder.
The web. config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With