[英]Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference. Version conflict
[英]Could not load file or assembly. The located assembly's manifest definition does not match the assembly reference
我正在嘗試在藍色棱鏡中添加谷歌視覺 API 功能之一,但出現錯誤
“內部:無法執行代碼階段,因為代碼階段拋出異常:無法加載文件或程序集 'Google.Apis.Auth, Version=1.35.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' 或其依賴項之一。找到的程序集的清單定義與程序集引用不匹配。(來自 HRESULT 的異常:0x80131040)”
但是提到的 dll 在 Blue Prism 文件夾中可用,我在初始化頁面中添加了引用。 Google.Apis.Auth當前版本是1.40.2,但是我試過1.35.1.0版本,還是沒有用。 我嘗試添加另一個線程中提到的參考“Google.Cloud.PubSub.V1”,但這也不能解決問題。
帶有此處提到的 dll 引用的以下代碼在 Visual Studio 中運行良好,但在 blueprism 中運行良好。
請有人幫我解決這個問題
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;
}
}
這可能是依賴版本沖突,這意味着您的應用程序可能依賴於多個版本的程序集。 您可以嘗試將程序集綁定添加到您的 app.config 文件或 web.config 文件(取決於您的項目類型),如下所示:
<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>
基本上它在運行時說,任何依賴於 0.0.0.0-1.40.2.0 版本的“Google.Apis.Auth”的東西,使用 1.40.2.0 版本的程序集。 然后您可以參考最新版本。
正如錯誤所說,它找不到您想要的參考的特定版本; 因此,程序集之間可能存在不匹配。 您可以做幾件事來排除故障:
1- 通過將其放入 GAC 或您的應用程序路徑,確保它可以找到正確版本的參考。
2- 您也可以在 packages.config 或 web.config 中檢查您的版本。
3- 在您的硬盤驅動器中搜索程序集,在結果頁面中選擇每個文件,查看屬性中的詳細信息選項卡並檢查版本,以便您可以找到不需要的版本的來源。
4-刪除bin文件夾並重建。
也檢查這個鏈接。
檢查 Web 應用程序的 Web.config。 我看到了我的重復條目。 一個有全部大寫的公共令牌。 所以我猜它是區分大小寫的,並且在我升級版本時沒有覆蓋。 所以它一直使用舊版本號,我顯然已經卸載了。 這可能是一種罕見的情況,但它可以幫助其他人。 希望這可以幫助。
這是存在的副本(如下)。
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.