'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;
}
}
Solution 1:[1]
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.
Solution 2:[2]
As the error says, it can't find the specific version of the reference you want; so, there may be a mismatch between assemblies.
You could do couple of things to troubleshoot:
1- Make sure that it can find the right version of the reference by putting it in the GAC or in your application path.
2- You may also check your version in packages.config or web.config .
3- Search your hard drive for the assembly, select each files in the result page, see the detail tab in properties and check the versions so you can find from where the unwanted version is coming .
4- delete bin folder and rebuild.
check this link too.
Solution 3:[3]
Check the Web.config of your web application. I saw a duplicate entry in mine. One had all caps public token. So I am guessing it is case sensitive and didn't over-write when I upgraded the version. So it kept using the old version number, which I had obviously uninstalled. This is probably a rare occurrence but it could help someone else. Hope this helps.
This was the duplicate that existed (below).
<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.27.1.0" newVersion="1.27.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Apis.Auth" publicKeyToken="4b01fa6e34db77ab" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.47.0.0" newVersion="1.47.0.0" />
</dependentAssembly> </assemblyBinding>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | SherryRuan |
Solution 2 | Simin Maleki |
Solution 3 | Bikey |