• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

BindingRedirect

suityou01

Potty-trained
Joined
Jan 20, 2009
Messages
21,122
Likes received
773
Thanks received
222
Location
Clown World
Got an app I wrote a while back and the customer has upgraded their server, and installed the latest version of the labelling software my app integrates with. Now version control is broken and it won't load my app as the .net assemblies have moved up in version. The overall signature of the assembly is identical so I thought a simple binding redirect would solve the problem.

Code:
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependency>
        <dependentAssembly>
          <assemblyIdentity name="Seagull.BarTender.Print" publicKeyToken="109ff779a1b4cbc7"/>
          <bindingRedirect oldVersion="9.40.1.1" newVersion="9.40.3.1"/>
        </dependentAssembly>
      </dependency>
    </assemblyBinding>
  </runtime>
</configuration>

This file is app.exe.config in the same path as the exe but it ignores it and still gives an error that it cannot find 9.4.1.1.

9.40.3.1 is showing up in the GAC.

Building a new build environment is to build against 9.40.3.1 looks like the only option but this takes time and I need a quick resolution to this, so the bindingRedirect looked like a good option. I also have other customers on various versions of this labelling software so a solution that uses this approach would be useful, and besides if Microsoft implemented it then it should indeed be possible.

Please show me the error of my ways. :rolleyes:
 
Update :

I removed the <dependency> tags and the error message has changed to indicate it has attempted to load the new interface.

Service cannot be started. System.BadImageFormatException: Could not load file or assembly 'Seagull.BarTender.Print, Version=9.40.3.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Seagull.BarTender.Print, Version=9.40.3.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7' ---> System.BadImageFormatException: Could not load file or assembly 'Seagull.BarTender.Print, Version=9.40.1.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Seagull.BarTender.Print, Version=9.40.1.1, Culture=neutral, PublicKeyToken=109ff779a1b4cbc7'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry...

Why is it trying to load both? Does it try the redirect first, and if that fails then try and load the old assembly?

Any thoughts?
 
or one of its dependencies

Does the new version definetly not have any new dependancies that need referencing, or copying onto server?
 
Does the new version definetly not have any new dependancies that need referencing, or copying onto server?

Stand down lads. It looks like the dependancies aren't registered. Vendor install program problem. I checked the dependancies with Checkasm.

That binding redirect only started working this morning after removing that tag, whereas I was staring at my monitor til late last night working on it.

At least I'm not a complete dullard eh? :rolleyes:
 

Advertisers

Back
Top