When using .NET Standard facades on .NET Framework, automatic binding redirects should be enabled
See original GitHub issueWe now automatically inject facades into the .NET Framework compilation when consuming a library that targets .NET Standard.
We need to make sure that when these facades are injected, that we forcefully enable automatic generation of binding redirects. That’s necessary because we deploy files that might have higher versions then what the .NET Standard binary is referencing. These files aren’t necessarily part of the runtime unification table or are explicitly opted-out by a minor version bump.
In non-SDK-style projects, the property <AutoGenerateBindingRedirects>
is defaulted to false
and relies on project templates to be set. The latter is only the case when the project got created targeting .NET Framework 4.5.1 or later. When an existing project is upgraded to 4.5.1 or later, the property is still false
. I suggest we set it to true
when we detect .NET Standard facades are needed.
My understanding is that in SDK-style projects the <AutoGenerateBindingRedirects>
is already true
if the project is targeting .NET Framework and producing an application.
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (16 by maintainers)
Top GitHub Comments
I’d say this is a very severe bug we need to fix.
Scenario
Expected Behavior
The app works.
Actual Behavior
The application crashes with
FileNotFoundException
:Manually setting
AutoGenerateBindingRedirect
toTrue
solves the problem, but there are no UI affordances for it and the error message isn’t actionable.Weird, I thought I had verified that I get zero warnings. Turns out you’re correct, I get this:
In that case I think I’m OK with this being fixed in 2.1.