And*_*rew 17 c# azure interopservices azure-application-insights webjob
每当我尝试运行具有应用程序洞察力和实体框架的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)
任何帮助将不胜感激
非常感谢
小智 19
确认dwilliss上面的评论也对我有用.解决方案是摆脱:
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
(就我的情况而言,来自app.config,适用于Windows服务.)我的项目仅与System.Runtime.InteropServices.RuntimeInformation间接依赖.它是我导入的NuGet包的依赖项.
Jon*_*007 13
你能错过配置文件中加载的程序集吗?确保在web.config中有类似于以下内容的内容.NuGet通常会这样做,但也许它没有,它不知道要加载什么
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
如果您已将项目的 .NET 运行时版本从 4.7.1 之前的版本更新到 4.7.1 或更高版本,请卸载 Nuget 包,删除/注释掉 App.config 部分(如果仍然存在),然后重新添加来自框架。从 4.7.1 开始,它就在框架中,在此之前您必须添加 Nuget 包。
[编辑]...根据迈克尔上面的评论,我在记忆中投票。
| 归档时间: |
|
| 查看次数: |
13032 次 |
| 最近记录: |