I’m looking at a web.config right now in ASP.NET WebForms .NET 3.5 that’s got all the primary config files broken out like thus:
<configuration>
<system.web>
<membership configSource="config\membership.config"/>
<authentication configSource="config\authentication.config"/>
<machineKey configSource="config\machineKey.config"/>
<compilation debug="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<customErrors mode="Off"/>
<authorization>
<deny users="?"/>
</authorization>
<roleManager enabled="true" cacheRolesInCookie="true"/>
<pages configSource="config\pages.config"/>
<httpHandlers configSource="config\httpHandlers.config"/>
<httpModules configSource="config\httpModules.config"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
and if I compile the source in VS 2010 it complains about not being able to find the .NET DataVisualization library (Error 14 Could not load file or assembly 'System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. sourcecodefile line) and if I compile it with the aspnet_compiler or just drop it in IIS, everything works fine.
How can I stop this from happening in VS?
Do I have to bring those config settings back into the web.config?
Casini doesn’t have a problem with this config, nor the IIS dev server, and the file is NOT in the GAC (not the 3.5 version anyways, the 4.0 is), and I won’t put it there for this one problem (I’ll move everything back into the web.config proper) and the dll file is in the bin folder.
You need to add a reference to the
System.Web.DataVisualizationassembly into your Visual Studio project. Visual Studio doesn’t compile against any assemblies not listed in the “References” folder.In the Solution Explorer, under your project, right-click on the “References” folder and click “Add Reference…”
Select and add the missing assembly.
Problem solved.