简体   繁体   English

有没有一种方法可以使AssemblyBinding-> bindingRedirect允许多个目标版本?

[英]Is there a way to have assemblyBinding->bindingRedirect allow several target versions?

I am in signed .NET assembly hell. 我在签名的.NET程序集地狱中。

I have an application compiled against signed Assembly A, version 1.1 ( SA 1.1.1 ) . 我有一个针对签名的Assembly A版本1.1( SA 1.1.1 )编译的应用程序。 On some systems I already have SA 1.1.2 在某些系统上,我已经具有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 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>

Use 采用

oldVersion="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. 如果GAC中同时具有两个版本,则只需绑定到应用程序中所需的版本即可。 Ie the apps that need to bind to 1.1.1 can specify that version. 即需要绑定到1.1.1的应用程序可以指定该版本。 The apps that need 1.1.2 can specify that binding. 需要1.1.2的应用程序可以指定该绑定。 Otherwise, I think the safest thing is to compile against 1.1.1 or 1.1.2 for all your apps. 否则,我认为最安全的方法是针对所有应用程序针对1.1.1或1.1.2进行编译。

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. 或者,最后但并非最不重要的一点是,对它们进行取消签名并针对未签名的版本进行编译,然后该版本将获取具有您指定的“友好”名称的程序集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM