Exclude WPF projects from source-build #5180
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.
Bug
Fixes: dotnet/source-build#3467
Regression? Last working version: Break caused by #5167
Description
The changes in #5167 updated projects to use SDK-style projects which caused them to be recognized by .NET's source-build infrastructure. Source-build attempted to build these projects and some of them ended up failing because they are defined as WPF projects which uses the Windows Desktop SDK. That fails in source-build because it only supports targeting for Linux.
This is fixed by updating the build system to exclude these two WPF projects from source-build. This follows the same pattern that is used by other .NET repos which are based on Arcade. But since the NuGet.Client repo doesn't use Arcade, a custom solution had to be implemented. Much of this implementation was taken directly from Arcade and adjusted to work in this repo. First, the relevant WPF-based projects are updated to set
ExcludeFromSourceBuild
totrue
. The build logic then works by checking whether .NET source-build is enabled (DotNetBuildFromSource
) and whether the project is excluded from source-build. If so, it overrides all the necessary MSBuild targets of the project so that it results in a no-op. This effectively causes the projects to be skipped from source-build.PR Checklist
PR has a meaningful title
PR has a linked issue.
Described changes
Tests
Documentation