SB patch to exclude WPF projects from nuget-client (#16507)
This commit is contained in:
parent
3b24233fbe
commit
c8aab02ed6
1 changed files with 88 additions and 0 deletions
|
@ -0,0 +1,88 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Matt Thalman <mthalman@microsoft.com>
|
||||
Date: Tue, 23 May 2023 16:04:38 -0500
|
||||
Subject: [PATCH] Exclude WPF projects from source-build
|
||||
|
||||
Backport: https://github.com/NuGet/NuGet.Client/pull/5180
|
||||
---
|
||||
Directory.Build.targets | 1 +
|
||||
...FromSourceBuild.AfterCommonTargets.targets | 21 +++++++++++++++++++
|
||||
eng/source-build/Noop.proj | 6 ++++++
|
||||
.../NuGet.Console/NuGet.Console.csproj | 1 +
|
||||
.../NuGet.PackageManagement.UI.csproj | 1 +
|
||||
5 files changed, 30 insertions(+)
|
||||
create mode 100644 eng/source-build/ExcludeFromSourceBuild.AfterCommonTargets.targets
|
||||
create mode 100644 eng/source-build/Noop.proj
|
||||
|
||||
diff --git a/Directory.Build.targets b/Directory.Build.targets
|
||||
index 04e2d5b14..06c729a21 100644
|
||||
--- a/Directory.Build.targets
|
||||
+++ b/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>
|
||||
diff --git a/eng/source-build/ExcludeFromSourceBuild.AfterCommonTargets.targets b/eng/source-build/ExcludeFromSourceBuild.AfterCommonTargets.targets
|
||||
new file mode 100644
|
||||
index 000000000..e5a428fef
|
||||
--- /dev/null
|
||||
+++ b/eng/source-build/ExcludeFromSourceBuild.AfterCommonTargets.targets
|
||||
@@ -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>
|
||||
diff --git a/eng/source-build/Noop.proj b/eng/source-build/Noop.proj
|
||||
new file mode 100644
|
||||
index 000000000..baededa3b
|
||||
--- /dev/null
|
||||
+++ b/eng/source-build/Noop.proj
|
||||
@@ -0,0 +1,6 @@
|
||||
+<Project>
|
||||
+ <Target Name="Restore" />
|
||||
+ <Target Name="Build" />
|
||||
+ <Target Name="Pack" />
|
||||
+ <Target Name="Test" />
|
||||
+</Project>
|
||||
diff --git a/src/NuGet.Clients/NuGet.Console/NuGet.Console.csproj b/src/NuGet.Clients/NuGet.Console/NuGet.Console.csproj
|
||||
index 0b467d504..285a6bebe 100644
|
||||
--- a/src/NuGet.Clients/NuGet.Console/NuGet.Console.csproj
|
||||
+++ b/src/NuGet.Clients/NuGet.Console/NuGet.Console.csproj
|
||||
@@ -8,6 +8,7 @@
|
||||
<Description>Package Manager PowerShell Console implementation.</Description>
|
||||
<TargetFramework>$(NETFXTargetFramework)</TargetFramework>
|
||||
<UseWpf>true</UseWpf>
|
||||
+ <ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
diff --git a/src/NuGet.Clients/NuGet.PackageManagement.UI/NuGet.PackageManagement.UI.csproj b/src/NuGet.Clients/NuGet.PackageManagement.UI/NuGet.PackageManagement.UI.csproj
|
||||
index df19b4641..066d338b5 100644
|
||||
--- a/src/NuGet.Clients/NuGet.PackageManagement.UI/NuGet.PackageManagement.UI.csproj
|
||||
+++ b/src/NuGet.Clients/NuGet.PackageManagement.UI/NuGet.PackageManagement.UI.csproj
|
||||
@@ -11,6 +11,7 @@
|
||||
<UseWinForms>true</UseWinForms>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<TargetFramework>$(NETFXTargetFramework)</TargetFramework>
|
||||
+ <ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
Loading…
Add table
Reference in a new issue