I am getting this error whenever I try and run a webjob project with application insight and entity framework.
System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
I have installed the following nuget packages
Microsoft.Azure.WebJobs.Logging.ApplicationInsights version 2.1.0-beta4
Microsoft.Extensions.Logging version 2.0.0
Microsoft.Extensions.Logging.Console version 2.0.0.
This all works with a new Visual studio 2017 webjob project, its when I try and include an existing code base, primarily using entity framework that I get this error. When I look at the reference in the one that works I don't have the System.Runtime.InteropServices.RuntimeInformation, yet it has been added to the project with entity framework. It seems to be part of .net standard, but how come I don't need .net standard for my new console app!
I'm not sure why its looking for Version 0.0.0.0 either as the one I have is 4.0.2.0
I have also tried adding this to the project file but this didn't work.
<PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> </PropertyGroup>
Any help would be greatly appreciated
Many thanks
Confirming the comment made above by dwilliss also worked for me. The solution was to get rid of:
<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>
(In my case from the app.config, for a Windows Service.) My project has an indirect dependency to System.Runtime.InteropServices.RuntimeInformation only. It is a dependency of a NuGet package I imported.
Could you be missing the loaded assembly from your configuration file? Ensure you have something similar to the following within your web.config. NuGet would normally do this but maybe it hasn't and it doesn't know what to load in
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With