Where are Web Application Project Assembly referen

2020-04-02 07:21发布

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.

4条回答
我命由我不由天
2楼-- · 2020-04-02 07:47

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>
查看更多
姐就是有狂的资本
3楼-- · 2020-04-02 07:57

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.

查看更多
SAY GOODBYE
4楼-- · 2020-04-02 08:06

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.

查看更多
兄弟一词,经得起流年.
5楼-- · 2020-04-02 08:08

I had the same issue, deleting .vs folder in the directory of the project solved the issue for me as it forced the recreation of .suo file which (though bite code) had reference to the web.config file in the wrong directory

查看更多
登录 后发表回答