Import WinFX Targets Only When Targeting .NETFramework #12789
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
MSBuild was seeing different behavior between
msbuild
anddotnet
builds with sdk style projects, so we stopped importing these targets for sdk style projects. The mistake we made when we implemented this fix was that we should have continued to import them for sdk style WPF projects that targeted.NETFramework
specifically.Customer Impact
This impacts all customers using SDK style WPF projects that target
.NETFramework
. They will import the incorrectMicrosoft.WinFx.targets
file and see failed builds unless they set theImportFrameworkWinFXTargets
property to any nonfalse
value. A couple of internal teams already have reported not being able to compile their projects using the 5.0 sdk including VSTest and project system.Regression?
Yes, by #10998
Risk
Low risk.
Test changes in this PR
No test changes.
Additional Notes
Fixes #12324 by importing framework winfx.targets only when
TargetFrameworkIdentifier
is.NETFramework
andUseWPF
is false. Otherwise,ImportFrameworkWinFXTargets
will be set to false and thus not import.Moved the import of winfx.targets after Microsoft.NET.TargetFrameworkInference.targets, so we know what the TargetFrameworkIdentifier is by the time we need to check it.
I wrote the same property twice with two separate conditions because of how we implemented ImportFrameworkWinFXTargets on the msbuild side. So I wrote this in a way that'seasier easier to read, although there's an extra line.
Note that any non false value is interpreted as "yes, import framework winfx targets".Side note, if TargetFrameworkIdentifier is netstandard, what should happen here?
Equivalent PR to master: #12786