无法加载文件或程序集 ServiceRuntime 2.4.0.0
Could not load file or assembly ServiceRuntime 2.4.0.0
将我们的项目升级为使用 Azure SDK 2.5 后,部署到 Azure(Web 角色)时出现以下运行时异常:
Could not load file or assembly
'Microsoft.WindowsAzure.ServiceRuntime, Version=2.4.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified.
其中一个来自 NuGet 的引用包仍在引用 ServiceRuntime 2.4.0.0
。据我所知,我需要做的就是在我们的 web.config
:
中创建一个 bindingRedirect
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0"/>
</dependentAssembly>
不幸的是,这不起作用。异常仍然存在。谁能指导一下?
我自己升级到 SDK 2.5 后遇到了与您现在相同的问题。我浏览了解决方案中的所有项目,并检查了对 Microsoft.WindowsAzure.ServiceRuntime 的所有引用。删除它们,然后使用 Add Reference 选项再次添加它们。 Select 再次组装,但请确保它是 2.5.0.0 版本。重建和重新部署。现在应该可以恢复正常了。
对我来说,将引用程序集的复制本地 属性 设置为 True 解决了这个问题。
- 在解决方案资源管理器中找到您的项目对库的引用。
- 右键单击并选择属性
- 在属性中 window 将复制本地设置为 True
将我们的项目升级为使用 Azure SDK 2.5 后,部署到 Azure(Web 角色)时出现以下运行时异常:
Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
其中一个来自 NuGet 的引用包仍在引用 ServiceRuntime 2.4.0.0
。据我所知,我需要做的就是在我们的 web.config
:
bindingRedirect
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0"/>
</dependentAssembly>
不幸的是,这不起作用。异常仍然存在。谁能指导一下?
我自己升级到 SDK 2.5 后遇到了与您现在相同的问题。我浏览了解决方案中的所有项目,并检查了对 Microsoft.WindowsAzure.ServiceRuntime 的所有引用。删除它们,然后使用 Add Reference 选项再次添加它们。 Select 再次组装,但请确保它是 2.5.0.0 版本。重建和重新部署。现在应该可以恢复正常了。
对我来说,将引用程序集的复制本地 属性 设置为 True 解决了这个问题。
- 在解决方案资源管理器中找到您的项目对库的引用。
- 右键单击并选择属性
- 在属性中 window 将复制本地设置为 True