I have a solution with multiple projects, two of them being MVC5 web apps.
Every time I update any nuget package in any project, the mvc apps' web.config is modified, adding the following:
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
</dependentAssembly>
This causes runtime error:
[BadImageFormatException: Could not load file or assembly 'System.Runtime' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)]
If I remove this entry from the web.config, everything works OK, it's just annoying to remember to do it every time.
Any ideea why is this happening?
so this came up for me after I had manually added a link to system.runtime.dll at location
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Runtime.dll
Removing this fixes this problem but the reason I added it in the first place was because I needed a portable nuget package that required that dll to build. So I ended up leaving it in place and manually deleting it all the time. :(
User contributions licensed under CC BY-SA 3.0