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

Exclude WPF projects from source-build #5180

Merged
merged 1 commit into from May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Build.targets
@@ -1,3 +1,4 @@
<Project>
<Import Project="build\common.targets" Condition="'$(IsCrossTargetingBuild)' == 'true' And '$(_WasCommonPropsImported)' != 'true'" />
<Import Project="eng\source-build\ExcludeFromSourceBuild.AfterCommonTargets.targets" Condition="'$(DotNetBuildFromSource)' == 'true'" />
</Project>
@@ -0,0 +1,21 @@
<Project>
<!--
If a project specifies ExcludeFromSourceBuild=true during a source build suppress all targets and emulate a no-op
(empty common targets like Restore, Build, Pack, etc.).
Inspired by https://github.com/dotnet/arcade/blob/d9275ca3f692b5f97702bb6717a3bf78afedbf38/src/Microsoft.DotNet.Arcade.Sdk/tools/ExcludeFromBuild.BeforeCommonTargets.targets
-->
<PropertyGroup>
<_SuppressAllTargets>false</_SuppressAllTargets>
<_SuppressAllTargets Condition="'$(DotNetBuildFromSource)' == 'true' and '$(ExcludeFromSourceBuild)' == 'true'">true</_SuppressAllTargets>
<!-- If excluding, then disable a restore warning, which will fire on newer SDKs, as well as set the NuGetRestoreTargets property to empty,
which will avoid importing the restore targets inside the .NET SDK. If the restore targets exist, then static graph restore will attempt tpo
execute. -->
<DisableWarnForInvalidRestoreProjects Condition="'$(_SuppressAllTargets)' == 'true'">true</DisableWarnForInvalidRestoreProjects>
<NuGetRestoreTargets Condition="'$(_SuppressAllTargets)' == 'true'">$(MSBuildThisFileDirectory)NoRestore.targets</NuGetRestoreTargets>
<!-- When a project is using the .NET SDK, but with the "UseWpf" property, there will be an attempt to import the windows desktop SDK targets.
These are not available in certain circumstances, like linux source build. -->
<ImportWindowsDesktopTargets Condition="'$(_SuppressAllTargets)' == 'true'">false</ImportWindowsDesktopTargets>
</PropertyGroup>

<Import Project="Noop.proj" Condition="'$(_SuppressAllTargets)' == 'true'" />
</Project>
6 changes: 6 additions & 0 deletions eng/source-build/Noop.proj
@@ -0,0 +1,6 @@
<Project>
<Target Name="Restore" />
<Target Name="Build" />
<Target Name="Pack" />
<Target Name="Test" />
</Project>
1 change: 1 addition & 0 deletions src/NuGet.Clients/NuGet.Console/NuGet.Console.csproj
Expand Up @@ -8,6 +8,7 @@
<Description>Package Manager PowerShell Console implementation.</Description>
<TargetFramework>$(NETFXTargetFramework)</TargetFramework>
<UseWpf>true</UseWpf>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
Expand Up @@ -11,6 +11,7 @@
<UseWinForms>true</UseWinForms>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<TargetFramework>$(NETFXTargetFramework)</TargetFramework>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
</PropertyGroup>

<ItemGroup>
Expand Down