相关疑难解决方法(0)

无法加载文件或程序集'System.Runtime.InteropServices.RuntimeInformation

每当我尝试运行具有应用程序洞察力和实体框架的webjob项目时,我都会收到此错误.

System.IO.FileLoadException:'无法加载文件或程序集'System.Runtime.InteropServices.RuntimeInformation,Version = 0.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)'

我安装了以下nuget包

Microsoft.Azure.WebJobs.Logging.ApplicationInsights版本2.1.0-beta4

Microsoft.Extensions.Logging版本2.0.0

Microsoft.Extensions.Logging.Console版本2.0.0.

这一切都适用于一个新的Visual Studio 2017 webjob项目,当我尝试包含现有的代码库时,主要使用实体框架,我得到了这个错误.当我查看工作中的引用时,我没有System.Runtime.InteropServices.RuntimeInformation,但它已经添加到具有实体框架的项目中.它似乎是.net标准的一部分,但为什么我的新控制台应用程序不需要.net标准!

在此输入图像描述

我不确定它为什么寻找版本0.0.0.0,因为我的版本是4.0.2.0

我也尝试将其添加到项目文件中,但这不起作用.

<PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
   <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激

非常感谢

c# azure interopservices azure-application-insights webjob

17
推荐指数
3
解决办法
1万
查看次数