Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Importing Framework's WinFX Targets By Default While Allowing Opt-Out #12764

Merged

Conversation

benvillalobos
Copy link
Member

@benvillalobos benvillalobos commented Aug 4, 2020

Should fix #12324.

We're running into MANY cases where disabling the default-import of framework's winfx.targets is breaking internal partners. This PR reverses that behavior.

Now it imports framework winfx.targets by default (as this seems to be the normal case), while allowing for "opt-out" of this behavior by setting ImportFrameworkWinFXTargets to false.

@benvillalobos
Copy link
Member Author

#12324 (comment)

Doing some quick testing (thanks @Forgind) it doesn't look like that suggestion works @dsplaisted . I'm thinking at this point we make this opt-in instead of opt-out. So if ImportWinFXTargets isn't set, SDK sets it to true by default. This reverts to functionality before the original issue and provides a workaround for those that run into that. How does this sound?

An interesting observation is that when we force ImportFrameworkWinFXTargets to true, we get a different issue in this repro. @davkean is this something you've seen before? This error happens on 16.8.0 Preview 2.0 [30404.33.master]. It looks unrelated to project system since it works in 16.6.5.

Error:

C:\Users\namytelk\Documents\GitHub\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS
\Waiting\VisualStudioWaitIndicator.cs(101,24): error CS8619: Nullability of reference types in value of type '(WaitInd
icatorResult Canceled, T?)' doesn't match target type '(WaitIndicatorResult, T)'. [C:\Users\namytelk\Documents\GitHub\
project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\Microsoft.VisualStudio.ProjectSystem.Managed.VS_q44
qb5gw_wpftmp.csproj]
C:\Users\namytelk\Documents\GitHub\project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\ProjectSystem\VS
\Waiting\VisualStudioWaitIndicator.cs(108,24): error CS8619: Nullability of reference types in value of type '(WaitInd
icatorResult Canceled, T?)' doesn't match target type '(WaitIndicatorResult, T)'. [C:\Users\namytelk\Documents\GitHub\
project-system\src\Microsoft.VisualStudio.ProjectSystem.Managed.VS\Microsoft.VisualStudio.ProjectSystem.Managed.VS_q44
qb5gw_wpftmp.csproj]

@benvillalobos benvillalobos changed the title Import Framework WinFX Targets By Default Only When Targeting .NETFramework Enable Importing Framework's WinFX Targets By Default While Allowing Opt-Out Aug 4, 2020
Copy link
Member

@dsplaisted dsplaisted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we should ever import these by default if targeting .NET Core. If I'm understanding the regressions correctly, they are all for projects that target .NET Framework. Does that make sense?

@Wesboy-Ren Wesboy-Ren merged commit 23abc73 into dotnet:master Aug 5, 2020
@Nirmal4G
Copy link
Contributor

Nirmal4G commented Aug 5, 2020

@benvillalobos This is already allowing opt-out. We could remove the entire section in the SDK and replace it with changes from dotnet/msbuild#5425 and dotnet/wpf#2976. This will surely fix a host of problems down the road.

Having this specified in multiple places creates confusion and more regressions. I propose we move them to MSBuild and the Desktop SDK targets (i.e. near to where the WinFX targets are actually imported).

@dsplaisted @rainersigwald Can we reopen (dotnet/msbuild#5425) and discuss this?

@chucker
Copy link

chucker commented Aug 5, 2020

I propose we move them to MSBuild and the Desktop SDK targets (i.e. near to where the WinFX targets are actually imported).

Unless I'm missing something: the Desktop SDK targets are for using WinFX (WPF) on top of .NET Core / .NET 5. This issue, however, affects apps that are on .NET Framework, but use Sdk-style projects, e.g. with the MSBuild.Sdk.Extras SDK, not the WindowsDesktop one.

@Nirmal4G
Copy link
Contributor

Nirmal4G commented Aug 5, 2020

Unless I'm missing something

The .NET SDK Extras already uses Desktop SDK props/targets if it is present. So, it'll be a cascading effect, if we fix them in MSBuild/WindowsDesktop SDKs.

@dsplaisted
Copy link
Member

#12786 updates the logic from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK upgrade causes compile failure due to not generating VB.NET WPF code behind
5 participants