开发者

Clarification required re: Use of .NET Assemblies in GAC - Set Up to use Globally?

I've done much reading and experimentation today regarding sigining of assemblies, and their installation into the GAC via various methods (mscorcfg.msc / drag and drop).

What I thought, was that once a file was in the GAC, you did not need to make references from projects开发者_StackOverflow中文版 in Visual studio. I know that you CAN make references via the usual Add Reference, Browse etc, but I thought it was automatic. Testing proves this not to be the case.

I came across a forum post looking to achieve the same outcome that suggested adding to the machine.config file under system.web as below.

This did not work, it in fact broke visual studio until I removed it.

   <assemblies>
                <add assembly="Blah.Framework.Logging, Version=1.0.3806.25580, Culture=neutral, PublicKeyToken=0beed4b631ebc3cd" />
            </assemblies>

What I want to know, is am I right in my assumed use of assemblies in the GAC, and is there a way of making them globally available?


Globally available doesn't mean a reference is automatically added to all your projects. It means that you don't need to copy the DLL into the application's probing path (the "Copy Local" option in Visual Studio). You still need to add a reference to your project from the GAC, but the assembly you choose is not copied to the project's bin folder (the first stop in the probing path.)

The practical purpose is to not have to redistribute the DLL(s) you reference along with your application. You add a reference to it, and that reference will be found on any machine that has the DLL added to it's GAC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜