开发者

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

开发者 https://www.devze.com 2023-02-15 16:57 出处:网络
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

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>


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. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消