.NET发布者策略目标框架 [英] .NET Publisher Policy Target Framework
问题描述
如何创建与重定向程序集目标框架版本相同的发布商策略程序集?
How do I create a publisher policy assembly that targets the same framework version as the redirected assembly?
我有一个 Assembly.dll
,版本为 1。 xy0
,我也有一个名为 policy.1.0.Assembly.dll
的发布者策略,该策略会重定向版本 1.0的版本。 0.0-1.xy0
到 1.xy0
。
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
.
Assembly.dll
面向.NET Framework 3.5。我是不是在认为 policy.1.0.Assembly.dll
也应该以.NET Framework 3.5为目标,以便在所有3.5+框架上都能正常工作?如果是,我该如何创建这样的发布者策略程序集?我在装配链接程序( AL
)上看不到任何相关的命令行开关。
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
).
当前,当我GAC装配时, Assembly.dll
最终以 \Windows\assembly
和 policy.1.0结尾。 Assembly.dll
结尾于 \Windows\Framework.NET\assembly
。 ILDASM向我展示了目标运行时不同:
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
:
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
:
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
}
推荐答案
从 C:\程序文件(x86)\Microsoft SDKs\Windows\v7.0A\Bin
使用程序集链接器似乎会产生一个针对正确运行时的 policy.1.0.Assembly.dll
:
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
将与Visual Studio一起交付多长时间。
- It is actually necessary.
- How long will the older
AL.EXE
be shipped with Visual Studio.
Lucian的VBlog帮助我了解SDK工具的组织方式:
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/
这篇关于.NET发布者策略目标框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!