无法加载文件或程序集 'Microsoft.Azure.Management.ServiceBus.Fluent'
Could not load file or assembly 'Microsoft.Azure.Management.ServiceBus.Fluent'
我正在通过我的控制台应用程序处理 Azure 服务总线。我有一个单独的项目,我已经安装了 nuGet 包“Microsoft.Azure.Management.ServiceBus.Fluent”包以使用命名空间获取连接字符串。安装软件包和 运行 应用程序后,出现此异常:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral or one of its dependencies. The system cannot find the file specified.'
如何解决?如果我可以添加任何其他详细信息,请在评论中留下它。
我怀疑您安装了最新版本的Microsoft.Azure.Management.ServiceBus.Fluent
:1.36.1。此外,您的 nuget 包之一依赖于它的版本 1.0.0.66.
要解决此问题,您可能需要将软件包降级到 1.0.0 版本或同等版本。
首先,我假设你已经安装了Microsoft.Azure.Management.ServiceBus.Fluent版本1.36.0
.
如果您的项目是具有packages.config
nuget包格式的网络框架,您可以尝试这些:
要更正路径,您应该先清理 nuget 缓存(删除 C:\Users\xxx\.nuget\packages
下的所有文件)和解决方案文件夹下的 packages
文件夹
然后运行下面的命令来更正路径:
update-package -reinstall
在工具-->Nuget 包管理器-->包管理器控制台。
还有,你可以只修改csproj
文件并将nuget包引用的hintpath
更改为正确的nuget dll路径。
<Reference Include="Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.Management.ServiceBus.Fluent.1.36.0\lib\net452\Microsoft.Azure.Management.ServiceBus.Fluent.dll</HintPath>
</Reference>
除了,添加bindingRedirect
可能是一个安全的选择。
在 app.config
文件下添加这个
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.Management.ServiceBus.Fluent" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.66" newVersion="1.0.0.66" />
</dependentAssembly>
</assemblyBinding>
</runtime>
============================================= ============
如果您的项目是具有PackageRefence nuget管理格式的网络核心项目,
您还应该先清理 nuget 缓存,然后删除 bin
和 obj
文件夹。
我正在通过我的控制台应用程序处理 Azure 服务总线。我有一个单独的项目,我已经安装了 nuGet 包“Microsoft.Azure.Management.ServiceBus.Fluent”包以使用命名空间获取连接字符串。安装软件包和 运行 应用程序后,出现此异常:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral or one of its dependencies. The system cannot find the file specified.'
如何解决?如果我可以添加任何其他详细信息,请在评论中留下它。
我怀疑您安装了最新版本的Microsoft.Azure.Management.ServiceBus.Fluent
:1.36.1。此外,您的 nuget 包之一依赖于它的版本 1.0.0.66.
要解决此问题,您可能需要将软件包降级到 1.0.0 版本或同等版本。
首先,我假设你已经安装了Microsoft.Azure.Management.ServiceBus.Fluent版本1.36.0
.
如果您的项目是具有packages.config
nuget包格式的网络框架,您可以尝试这些:
要更正路径,您应该先清理 nuget 缓存(删除 C:\Users\xxx\.nuget\packages
下的所有文件)和解决方案文件夹下的 packages
文件夹
然后运行下面的命令来更正路径:
update-package -reinstall
在工具-->Nuget 包管理器-->包管理器控制台。
还有,你可以只修改csproj
文件并将nuget包引用的hintpath
更改为正确的nuget dll路径。
<Reference Include="Microsoft.Azure.Management.ServiceBus.Fluent, Version=1.0.0.66, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Azure.Management.ServiceBus.Fluent.1.36.0\lib\net452\Microsoft.Azure.Management.ServiceBus.Fluent.dll</HintPath>
</Reference>
除了,添加bindingRedirect
可能是一个安全的选择。
在 app.config
文件下添加这个
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.Management.ServiceBus.Fluent" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.0.66" newVersion="1.0.0.66" />
</dependentAssembly>
</assemblyBinding>
</runtime>
============================================= ============
如果您的项目是具有PackageRefence nuget管理格式的网络核心项目,
您还应该先清理 nuget 缓存,然后删除 bin
和 obj
文件夹。