I have two assemblies, created through conditional compilation (dev and real).
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.
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.
Is there a way to force a specific ASP.NET application to use the dev one (which is in /bin
), given that:
Version
and PublicKeyToken
.I noticed that someone already asked this in #991293, but the accepted answer involved removing the signing, which isn't an option here.
Am I out of luck?
No there is no way to do this. When loading an assembly the CLR will check to see if a DLL with an equivalent strong name is present in the GAC. If there is a matching assembly in the GAC it will pick the GAC assembly every time. There is unfortunately no way to override this behavior.