强制加载程序集的/ bin和不GAC? [英] Force load an assembly from the /bin and not the GAC?
问题描述
我有两个组件,通过条件编译(开发和实际)。
I have two assemblies, created through conditional compilation (dev and real).
这些组件的公共表面是100%相同:都是强命名;两者都使用相同的 .SNK
,因此具有相同的公钥
签署;都具有相同的文化,相同的版本。我无法改变这一点:使它们看起来相同的是整点
The public surface of these assemblies is 100% identical: both are strongly named; both are signed with the same .snk
and therefore have the same PublicKeyToken
; both have the same culture and the same version. I cannot change this: making them appear identical is the whole point.
不过,我的机器上真正的程序集是在GAC。我有一个ASP.NET 3.5的WebForms应用程序,引用开发组件。它绝对要做到这一点;实际的汇编崩溃的应用程序。
However, on my machine the real assembly is in the GAC. I have an ASP.NET 3.5 WebForms app that references the dev assembly. It absolutely must do that; the real assembly crashes the app.
有没有办法强制特定的ASP.NET应用程序使用开发一(这是在 /箱
),因为:
Is there a way to force a specific ASP.NET application to use the dev one (which is in /bin
), given that:
- 有一个在GAC中。
- 都具有相同的
版本
和公钥
。 - 在两者都强命名/使用相同的密钥签名。
- 在我无法改变他们,不能更改版本,而不能拔出钥匙。
- There is one in the GAC.
- Both have the same
Version
andPublicKeyToken
. - Both are strongly named/signed with the same key.
- I can not change them, can't change the version, and can't remove the key.
我发现已经有人问这#991293 ,但接受的答案涉及删除的签署,这是不一个不错的选择。
I noticed that someone already asked this in #991293, but the accepted answer involved removing the signing, which isn't an option here.
我是运气不好?
推荐答案
GAC总是第一次尝试,装订组件时:的运行时如何定位程序集
GAC is always tried first, when binding assemblies: How the Runtime Locates Assemblies
所以,不,你不能做到这一点。但是,如果你解释的为什么的你有这样奇怪的要求,有可能是围绕着不同的工作,你有没有想过的。
So no, you can't do this. However if you explain why you have such strange requirements there might be a different work around, you have not thought of.
这篇关于强制加载程序集的/ bin和不GAC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!