Skip to content

.NET Framework web projects fail with BadImageFormatException when referencing netstandard1.5 or later library #1509

@ericstj

Description

@ericstj

This 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions