gpt4 book ai didi

c# - Nuget版本不匹配错误出现两种解决方案

转载 作者:行者123 更新时间:2023-11-30 17:41:49 24 4
gpt4 key购买 nike

我正在为我的 Azure 移动服务开发移动后端/Web API,当我尝试调试代码时收到此消息。 Azure 配置代码存在于不同的 C# 类库中,我相信它们之间存在版本不匹配。

Additional information: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

错误来自这一行:

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
CloudBlobContainer container = blobClient.GetContainerReference("photos");

以上行用于将图像 blob 上传到我的 Blob 存储。我认为这是后端和 Azure 云 API 之间的版本不匹配。您认为这个错误意味着什么?

最佳答案

半生不熟的想法:)

想法 1 在这两个项目中,打开 packages.config 文件。查看这两个文件是否引用相同版本的 Microsoft.WindowsAzure.Configuration。如果它们不同,您可以使用包管理器控制台升级或降级其中一个项目。

// update to a specific version of a package
Update-Package MyPackage -Version [an earlier or later version]

// update all packages within a project
Update-Package -Project ProjectName

Idea 2 在这两个项目中,还要检查 web.config > runtime > assemblyBinding 部分,看看是否存在有问题的 bindingRedirect Microsoft.WindowsAzure.Configuration

想法 3 要获得更全面的方法,请使用程序集绑定(bind)日志查看器。首先,从 Visual Studio 的开发人员命令提示符中运行 Fuslogvw.exe

有用的链接

Troubleshooting NuGet references

The located assembly's manifest definition does not match the assembly reference

Updating All Packages

Could not load file or assembly… NuGet Assembly Redirects

Assembly Binding Log Viewer (Fuslogvw.exe)

关于c# - Nuget版本不匹配错误出现两种解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32424280/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com