.NET Framework web projects fail with BadImageFormatException when referencing netstandard1.5 or later library
See original GitHub issueThis is happening when someone tries to debug the web application. Something in the web project system is copying reference-only (Private=false, CopyLocal=false) assemblies to the output directory, and then ASP.NET later tries to load these for execution. See https://github.com/dotnet/corefx/issues/23229.
We should get to the bottom of why this happens, it seems to only do it for assemblies which don’t already have an implementation in the output directory. The only case like this is the netfx.force.conflicts.dll
.
Regardless of root cause we probably need a workaround in the SDK since these targets need to work on older versions of Visual Studio (which will never see any fix made to the web project system).
Since netfx.force.conflicts.dll
is not needed at compile time at all, we can actually remove it from ReferencePath after RAR is done with it. It’s sole purpose is to force conflicts for every assembly that is inbox so that bindingRedirects will be generated to the assemblies in the app.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9 (6 by maintainers)
Top GitHub Comments
Here’s the workaround:
@livarcocc if possible we should try and get this in for servicing.
Fixed it by deleting the netfx.conflict dll in project bin folder