有没有办法让 assemblyBinding->bindingRedirect 允许多个目标版本?
我正处于签名的.NET 程序集地狱中。
我有一个针对已签名的程序集 A 版本 1.1 (SA 1.1.1) 编译的应用程序。在某些系统上我已经有 SA 1.1.2
是否可以在重定向中表达这一点?
SA 1.1.1 绑定到
SA 1.1.1 或
SA 1.1.2
只是提醒您这样的事情是什么样子的:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I am in signed .NET assembly hell.
I have an application compiled against signed Assembly A, version 1.1 (SA 1.1.1) . On some systems I already have SA 1.1.2
Is it possible to express this in the redirect?
SA 1.1.1 binds to
SA 1.1.1 OR
SA 1.1.2
Just to remind you how such a thing looks like:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用oldVersion="1.0.0.0-2.0.0.0"
注意表示范围的破折号。抱歉,我想你却反其道而行之。
我认为这是不可能的。
不过,您可以做几件事。如果您在 GAC 中拥有这两个版本,则只需在应用程序中绑定到您需要的版本即可。即需要绑定到1.1.1的应用程序可以指定该版本。需要 1.1.2 的应用程序可以指定该绑定。否则,我认为最安全的做法是针对所有应用程序针对 1.1.1 或 1.1.2 进行编译。
或者,最后但并非最不重要的一点是,取消对它们的签名并针对未签名的版本进行编译,然后该版本将获取具有您指定的“友好”名称的任何程序集。
UseoldVersion="1.0.0.0-2.0.0.0"
Notice the dash denoting a range.Sorry, thought you were going the other way around.
I don't think this is possible.
There are a couple things you can do though. If you have both versions in the GAC, you can just bind to the version you need in the app. I.e. the apps that need to bind to 1.1.1 can specify that version. The apps that need 1.1.2 can specify that binding. Otherwise, I think the safest thing is to compile against 1.1.1 or 1.1.2 for all your apps.
Or, last but not least, unsign them and compile against an unsigned version, which will then grab whatever assembly has the "friendly" name you specify.