Fix test projects which reference self-contained Exes #17594
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.
Fix #17579
Description
In #15134, we added an error when a self-contained app references a non self-contained app, or vice versa. This is because if you are trying to get copies of both apps in the output folder, they won't both work.
However, I didn't consider that test projects are also use the
Exe
OutputType. So with that change, test projects which reference Exe projects which were self-contained would fail to build.Customer Impact
Test projects referencing Exe projects (fairly common, especially for Web projects) which were self-contained (not as common, but enough that at least two projects hit this bug in the preview) would fail to build. This could be worked around by setting the
ValidateExecutableReferencesMatchSelfContained
property to false, but developers would have to look through our MSBuild code or search for help on the internet to figure out they needed to do that.Regression?
Regressed from 5.0.2xx and prior behavior in #15134.
Risk
[Justify the selection above]
The change is to disable the error check for unit test projects, and is a simple code change.
Verification
Added test cases covering failing scenario
Packaging changes reviewed?
Addresses [issue number]
#17579