views:

650

answers:

3

Where are assembly refernces stored for a web application?

In a Web Site, I see assembly tags written to the assembly node in the web.config when you add a reference. I am just curious as to how the Web Application Project makes the connection to get the correct local dll?

I manually add the reference and the application builds, but the dll is not imported into the BIN folder, and the assembly nodes are not created in the web config as they are in a Web Site. I do a solution search for the text 'assembly="SomeAssembly..." and no results are found.

I am just curious as I am trying to centralize updating assembly references as a 3rd party control vendor puts out hotfixes on a regular basis and we end up having to run around and update all the individual page refernces to the assembly. I was able to do this effectively in the Web Site project, but I am fairly new to Web Application Projects. Any advice or links would be appreciated. I guess I'm looking for tips on assembly & control reference management for ASP.NET Web Application Projects.

A: 

Since the assembly was not imported to the BIN folder, and your application works, I assume that it is stored in the GAC (global assembly cache) and marked as "copy local=false" in the reference properties. You don't see the reference to the assembly in the web.config, since your code behind assembly - YourApp.dll (which is always created for web-applications), contains a standard assembly reference to that assembly. When you run your application it loads the assembly from the GAC.

Doron Yaacoby
A: 

Those "missing" dlls are probably in the Global Assembly Cache and are available to all .NET applications.

You can add control references to the pages/controls section of web.config, which will apply to all pages in the application.

jrummell
+1  A: 

Like most Visual Studio projects, references are kept in the project.

There are two kinds of reference:

Project References are references to another project in the same solution. They look like this:

<ProjectReference Include="..\VBClassLibrary1\VBClassLibrary1.vbproj">
  <Project>{045D7D9F-8E44-4C4B-95F8-620E86593C5B}</Project>
  <Name>VBClassLibrary1</Name>
</ProjectReference>

File references are references to an arbitrary file on disk:

<Reference Include="System.Core">
  <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>

If you expand the References folder and click on a reference, then look in the Properties window, you'll see that both kinds of reference have a "Copy Local" property. For project references it defaults to true, for file references to false (though maybe that's only if the file is in the GAC). Changing the default adds:

  <Private>False</Private>
John Saunders