How do I create a publisher policy assembly that targets the same framework version as the redirected assembly?
I have an Assembly.dll
with version 1.x.y.0
and I also have a publisher policy for it named policy.1.0.Assembly.dll
which redirects versions 1.0.0.0-1.x.y.0
to 1.x.y.0
.
The Assembly.dll
targets .NET Framework 3.5. Am I right in thinking that the policy.1.0.Assembly.dll
should also target .NET Framework 3.5 for things to work correctly on all frameworks 3.5+? If yes, how do I go about creating such a publisher policy assembly? I cannot see any relevant command line switch on the Assembly Linker (AL
).
Currently when I GAC the assemblies, Assembly.dll
ends up in \Windows\assembly
and policy.1.0.Assembly.dll
ends up in \Windows\Framework.NET\assembly
. ILDASM shows me that the targeted runtimes are different:
Assembly.dll
:
// Metadata version: v2.0.50727
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
.assembly extern System
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 2:0:0:0
}
policy.1.0.Assembly.dll
:
// Metadata version: v4.0.30319
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (B6 24 5D 64 2D 23 95 0B 50 19 B4 DC 19 4B 9A E8 // .$]d-#..P....K..
B9 FF C0 53 ) // ...S
.ver 4:0:0:0
}
Using the Assembly Linker from C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
appears to produce a policy.1.0.Assembly.dll
that targets the correct runtime:
// Metadata version: v2.0.50727
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.hash = (15 3B C0 4F 38 2D 09 20 CC A2 58 01 EE B1 AB E2 // .;.O8-. ..X.....
D2 D0 C5 11 )
.ver 2:0:0:0
}
While this appears to do what I want, it is unclear whether:
AL.EXE
be shipped with Visual Studio.Lucian's VBlog was helpful in letting me understand how SDK tools are organized:
https://blogs.msdn.microsoft.com/lucian/2008/11/14/where-are-the-sdk-tools-where-is-ildasm/