Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference

I am trying to add one of the google vision API feature in the blue prism but I am getting the error

"Internal: Could not execute code stage because an exception is thrown by code stage: Could not load file or assembly 'Google.Apis.Auth, Version=1.35.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

But the mentioned dll is available in the Blue prism folder and I have added the reference in the initialize page. The current version of Google.Apis.Auth is 1.40.2 but I tried the version 1.35.1.0, still no use. I tried adding the reference "Google.Cloud.PubSub.V1" as mentioned in the other thread but that doesn't resolve the issue as well.

The below code with the dll references mentioned here is working well in the visual studio but not in blueprism.

Please, someone, help me to resolve this issue

  var image = Image.FromFile("C:/New folder/Google VisionAI/otter_crossing.jpg");
  var client = ImageAnnotatorClient.Create();
  var response = client.DetectText(image);      

  foreach (var annotation in response)
  {
       if (annotation.Description != null)
       {
           Output = annotation.Description;
       }
  }        
like image 258
robt Avatar asked Sep 01 '25 10:09

robt


1 Answers

It might be a dependency version conflict, meaning your app may have dependency on multiple versions of the assembly. You can try to add assembly binding to your app.config file or web.config file (depends on your project type), something like this:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-1.40.2.0" newVersion="1.40.2.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Basically it says in runtime, anything that depends on "Google.Apis.Auth" from version 0.0.0.0-1.40.2.0, use the assembly with version 1.40.2.0. And then you can reference the newest version.

like image 175
SherryRuan Avatar answered Sep 03 '25 07:09

SherryRuan