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

828 views Asked by At

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

There are 1 answers

3
richard On

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.