本文介绍了如何prevent一个.NET应用程序使用的程序集从GAC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以配置.NET应用程序的方式(在Visual Studio中设置),它引用了本地组件(不是在的),而不是GAC内的程序集,尽管这两个组件具有相同的名称和相同的版本?

解决方案

如果这两个组件都是强名称(签字),CLR将始终从GAC加载。

下面是运行时用来解析程序集引用(步骤从运行时如何定位程序集

由于在同一篇文章后说:

所以,如果你能负担得起删除该地方议会签署,该应用程序将使用而不是一个在GAC吧。

有关更详细的比你很可能永远希望有关运行时绑定机制,请参见苏珊娜·库克的博客

This从斯科特Hanselman的博客条目还提供了结合过程的一个很好的概述。

Can I configure a .NET application in a way (settings in Visual Studio) that it references a "local" assembly (not in GAC) instead of an assembly within the GAC, although both assemblies have the same name and the same version?

解决方案

If both assemblies are strong-named (signed), the CLR will always load from the GAC.

Here are the steps the runtime uses to resolve assembly references (from How the Runtime Locates Assemblies):

As stated later in that same article:

So if you can afford to remove signing from the local assembly, the application will use it instead of the one in the GAC.

For more detail than you could probably ever want about the runtime-binding mechanisms, see Suzanne Cook's blog.

This blog entry from Scott Hanselman also provides a great overview of the binding process.

这篇关于如何prevent一个.NET应用程序使用的程序集从GAC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:12