Repository navigation
Generate binding redirects for .NET 4.7.2+ - #2885
Conversation
There was a problem hiding this comment.
Another reference to TargetFrameworkVersion.Substring(1) indicates that there's not always a leading "v".
Does this need similar logic?
There was a problem hiding this comment.
I don't know why that logic is the way it is. All the other comparisons assume it starts with a v. But yeah, should be cautious.
|
I confirmed that these worked with a private internal .NET 4.7.2 developer pack by creating a new project and referencing <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="WindowsAzure.Storage" Version="7.2.1" />Then removing the NuGet-altered binding redirects, removing the template binding redirect generation, and confirming that binding redirects still got created. |
In The Old Days, binding redirect generation was set to off-by-default. That has caused a great deal of confusion because it's usually the right thing to do but it's not obvious when you need to do it. Unfortunately, we currently think we can't change the default for all projects, because a user could have been avoiding binding redirects intentionally, making creating them a breaking change. Since no projects currently target .NET Framework 4.7.2 (since it's not released), it is not a breaking change to turn on binding redirects by default for this (and higher) versions--a user must explicitly opt into targeting the framework and thus into this new behavior. A user can still specify ```xml <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> ``` to explicitly opt out of binding redirects for a given project. Closes dotnet#2481, in partial support of https://github.com/dotnet/designs/blob/2be39b7e1bc9c4df45b1d51ebb2d1abb0689e4e0/accepted/automatic-redirects-by-default/automatic-redirects-by-default.md
Fixes dotnet#2886 by stripping either case of `v` from `$(TargetFrameworkVersion)` in a single call.
1819a47 to
f388fc5
Compare
|
@dotnet-bot test this please |
|
fyi @dsplaisted this carries a fix for #2886. |
terrajobst
left a comment
There was a problem hiding this comment.
It looks good to me but I don't think it addresses the perf concerns regarding running more data through RAR when building class libraries.
| <PropertyGroup> | ||
| <GenerateBindingRedirectsOutputType Condition="'$(OutputType)'=='exe' or '$(OutputType)'=='winexe'">true</GenerateBindingRedirectsOutputType> | ||
| <!-- It would be a breaking change to automatically turn on binding redirects for existing projects, so turn them on only when opting into a new framework. --> | ||
| <AutoGenerateBindingRedirects Condition="'$(AutoGenerateBindingRedirects)' == '' and '$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(TargetFrameworkVersion.TrimStart(vV))' >= '4.7.2'">true</AutoGenerateBindingRedirects> |
There was a problem hiding this comment.
What about class libraries? We talked about not wanting to turn this feature on for class libraries unless they are unit test projects.
In The Old Days, binding redirect generation was set to off-by-default.
That has caused a great deal of confusion because it's usually the right
thing to do but it's not obvious when you need to do it.
Unfortunately, we currently think we can't change the default for all
projects, because a user could have been avoiding binding redirects
intentionally, making creating them a breaking change.
Since no projects currently target .NET Framework 4.7.2 (since it's not
released), it is not a breaking change to turn on binding redirects by
default for this (and higher) versions--a user must explicitly opt into
targeting the framework and thus into this new behavior.
A user can still specify
to explicitly opt out of binding redirects for a given project.
Closes #2481, in partial support of
https://github.com/dotnet/designs/blob/2be39b7e1bc9c4df45b1d51ebb2d1abb0689e4e0/accepted/automatic-redirects-by-default/automatic-redirects-by-default.md