269 lines
13 KiB
Diff
269 lines
13 KiB
Diff
![]() |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|||
|
From: Logan Bussell <loganbussell@microsoft.com>
|
|||
|
Date: Tue, 19 Jul 2022 14:47:28 -0700
|
|||
|
Subject: [PATCH] Update projects to net7.0 TFM with shared property, Only enable trimming for .NET Core
|
|||
|
|
|||
|
Backport PR: https://github.com/dotnet/command-line-api/pull/1803
|
|||
|
---
|
|||
|
Directory.Build.props | 1 +
|
|||
|
global.json | 7 ++++---
|
|||
|
.../System.CommandLine.ApiCompatibility.Tests.csproj | 2 +-
|
|||
|
.../System.CommandLine.Benchmarks.csproj | 4 ++--
|
|||
|
.../System.CommandLine.DragonFruit.Tests.csproj | 2 +-
|
|||
|
.../System.CommandLine.Generator.Tests.csproj | 2 +-
|
|||
|
.../System.CommandLine.Hosting.Tests.csproj | 2 +-
|
|||
|
.../System.CommandLine.NamingConventionBinder.Tests.csproj | 2 +-
|
|||
|
.../System.CommandLine.Rendering.Tests.csproj | 2 +-
|
|||
|
.../EndToEndTestApp/EndToEndTestApp.csproj | 2 +-
|
|||
|
.../dotnet-suggest.Tests.csproj | 2 +-
|
|||
|
src/System.CommandLine.Suggest/dotnet-suggest.csproj | 2 +-
|
|||
|
.../System.CommandLine.Tests.csproj | 2 +-
|
|||
|
.../TestApps/NativeAOT/NativeAOT.csproj | 4 ++--
|
|||
|
.../TestApps/Trimming/Trimming.csproj | 4 ++--
|
|||
|
src/System.CommandLine/System.CommandLine.csproj | 7 +++++--
|
|||
|
16 files changed, 26 insertions(+), 21 deletions(-)
|
|||
|
|
|||
|
diff --git a/Directory.Build.props b/Directory.Build.props
|
|||
|
index c0c5f79a..901c57c7 100644
|
|||
|
--- a/Directory.Build.props
|
|||
|
+++ b/Directory.Build.props
|
|||
|
@@ -9,6 +9,7 @@
|
|||
|
<NoWarn Condition=" '$(DotnetBuildFromSource)' == 'true' ">$(NoWarn);CS8714;CS8765;CS8600;CS8601;CS8602;CS8603;CS8604</NoWarn>
|
|||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
|||
|
<LangVersion>10.0</LangVersion>
|
|||
|
+ <TargetFrameworkForNETSDK>net7.0</TargetFrameworkForNETSDK>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
diff --git a/global.json b/global.json
|
|||
|
index 1c6fd268..f5bec611 100644
|
|||
|
--- a/global.json
|
|||
|
+++ b/global.json
|
|||
|
@@ -1,12 +1,13 @@
|
|||
|
{
|
|||
|
"tools": {
|
|||
|
- "dotnet": "6.0.100",
|
|||
|
+ "dotnet": "7.0.100-preview.6.22352.1",
|
|||
|
"runtimes": {
|
|||
|
"dotnet": [
|
|||
|
- "5.0.10"
|
|||
|
+ "5.0.17",
|
|||
|
+ "6.0.7"
|
|||
|
]
|
|||
|
},
|
|||
|
- "xcopy-msbuild": "16.10.0-preview2"
|
|||
|
+ "xcopy-msbuild": "17.1.0"
|
|||
|
},
|
|||
|
"msbuild-sdks": {
|
|||
|
"Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22168.2"
|
|||
|
diff --git a/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj b/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
|
|||
|
index 30bcd139..4cc48fde 100644
|
|||
|
--- a/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.ApiCompatibility.Tests/System.CommandLine.ApiCompatibility.Tests.csproj
|
|||
|
@@ -1,7 +1,7 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<IsPackable>false</IsPackable>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
diff --git a/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj b/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
|
|||
|
index e54aabc4..185ba62a 100644
|
|||
|
--- a/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
|
|||
|
+++ b/src/System.CommandLine.Benchmarks/System.CommandLine.Benchmarks.csproj
|
|||
|
@@ -9,8 +9,8 @@
|
|||
|
<UseSharedCompilation>false</UseSharedCompilation>
|
|||
|
|
|||
|
<!-- Supported target frameworks -->
|
|||
|
- <TargetFrameworks Condition="'$(TargetFrameworks)' == '' AND '$(OS)' == 'Windows_NT'">net461;net5.0;net6.0;</TargetFrameworks>
|
|||
|
- <TargetFrameworks Condition="'$(TargetFrameworks)' == ''">net5.0;net6.0;</TargetFrameworks>
|
|||
|
+ <TargetFrameworks Condition="'$(TargetFrameworks)' == '' AND '$(OS)' == 'Windows_NT'">net461;net5.0;net6.0;net7.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks Condition="'$(TargetFrameworks)' == ''">net5.0;net6.0;net7.0</TargetFrameworks>
|
|||
|
|
|||
|
<!-- This repo does not produce any libraries, therefore generating docs is disabled -->
|
|||
|
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
|||
|
diff --git a/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj b/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
|
|||
|
index 7eee0b38..e504f7e8 100644
|
|||
|
--- a/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj
|
|||
|
@@ -1,6 +1,6 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<StartupObject>AutoGeneratedProgram</StartupObject>
|
|||
|
<!-- Ensure that an XML doc file is emitted to supply command line help -->
|
|||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|||
|
diff --git a/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj b/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
|
|||
|
index a423eb1e..20f0f410 100644
|
|||
|
--- a/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj
|
|||
|
@@ -1,6 +1,6 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFrameworks>net6.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks>$(TargetFrameworkForNETSDK)</TargetFrameworks>
|
|||
|
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
|
|||
|
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
|||
|
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
|
|||
|
diff --git a/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj b/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
|
|||
|
index 328b4e12..8e2cd6ea 100644
|
|||
|
--- a/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj
|
|||
|
@@ -1,7 +1,7 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFrameworks>net6.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks>$(TargetFrameworkForNETSDK)</TargetFrameworks>
|
|||
|
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
|
|||
|
<IsPackable>false</IsPackable>
|
|||
|
</PropertyGroup>
|
|||
|
diff --git a/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj b/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
|
|||
|
index 43eb7c29..7bff1796 100644
|
|||
|
--- a/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj
|
|||
|
@@ -1,6 +1,6 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFrameworks>net6.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks>$(TargetFrameworkForNETSDK)</TargetFrameworks>
|
|||
|
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
|
|||
|
<LangVersion>10</LangVersion>
|
|||
|
</PropertyGroup>
|
|||
|
diff --git a/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj b/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
|
|||
|
index 1c116508..afd6dc6a 100644
|
|||
|
--- a/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.Rendering.Tests/System.CommandLine.Rendering.Tests.csproj
|
|||
|
@@ -1,7 +1,7 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<IsPackable>false</IsPackable>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
diff --git a/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj b/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
|
|||
|
index 9a3eb54d..76add0d5 100644
|
|||
|
--- a/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
|
|||
|
+++ b/src/System.CommandLine.Suggest.Tests/EndToEndTestApp/EndToEndTestApp.csproj
|
|||
|
@@ -6,7 +6,7 @@
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
<OutputType>Exe</OutputType>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
</Project>
|
|||
|
diff --git a/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj b/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
|
|||
|
index da6abedf..f1711a10 100644
|
|||
|
--- a/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj
|
|||
|
@@ -1,7 +1,7 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<ItemGroup>
|
|||
|
diff --git a/src/System.CommandLine.Suggest/dotnet-suggest.csproj b/src/System.CommandLine.Suggest/dotnet-suggest.csproj
|
|||
|
index fd825008..ce4bda1d 100644
|
|||
|
--- a/src/System.CommandLine.Suggest/dotnet-suggest.csproj
|
|||
|
+++ b/src/System.CommandLine.Suggest/dotnet-suggest.csproj
|
|||
|
@@ -1,7 +1,7 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
<PropertyGroup>
|
|||
|
<OutputType>Exe</OutputType>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<IsPackable>true</IsPackable>
|
|||
|
<PackAsTool>true</PackAsTool>
|
|||
|
<PackageId>dotnet-suggest</PackageId>
|
|||
|
diff --git a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
|
|||
|
index c1988ec4..44b5c9fc 100644
|
|||
|
--- a/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
|
|||
|
+++ b/src/System.CommandLine.Tests/System.CommandLine.Tests.csproj
|
|||
|
@@ -1,6 +1,6 @@
|
|||
|
<Project Sdk="Microsoft.NET.Sdk">
|
|||
|
<PropertyGroup>
|
|||
|
- <TargetFrameworks>net6.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks>$(TargetFrameworkForNETSDK)</TargetFrameworks>
|
|||
|
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
|
|||
|
<GenerateProgramFile>false</GenerateProgramFile>
|
|||
|
</PropertyGroup>
|
|||
|
diff --git a/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj b/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
|
|||
|
index b0036ed0..cc306fea 100644
|
|||
|
--- a/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
|
|||
|
+++ b/src/System.CommandLine.Tests/TestApps/NativeAOT/NativeAOT.csproj
|
|||
|
@@ -2,13 +2,13 @@
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
<OutputType>Exe</OutputType>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<!-- producing more detailed log output -->
|
|||
|
<TrimmerSingleWarn>false</TrimmerSingleWarn>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <SystemCommandLineDllPath Condition="'$(SystemCommandLineDllPath)'==''">..\..\..\System.CommandLine\bin\Release\net6.0\System.CommandLine.dll</SystemCommandLineDllPath>
|
|||
|
+ <SystemCommandLineDllPath Condition="'$(SystemCommandLineDllPath)'==''">..\..\..\System.CommandLine\bin\Release\$(TargetFrameworkForNETSDK)\System.CommandLine.dll</SystemCommandLineDllPath>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<ItemGroup>
|
|||
|
diff --git a/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj b/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
|
|||
|
index 6dcf8892..615b0764 100644
|
|||
|
--- a/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
|
|||
|
+++ b/src/System.CommandLine.Tests/TestApps/Trimming/Trimming.csproj
|
|||
|
@@ -2,7 +2,7 @@
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
<OutputType>Exe</OutputType>
|
|||
|
- <TargetFramework>net6.0</TargetFramework>
|
|||
|
+ <TargetFramework>$(TargetFrameworkForNETSDK)</TargetFramework>
|
|||
|
<ImplicitUsings>enable</ImplicitUsings>
|
|||
|
<Nullable>enable</Nullable>
|
|||
|
<PublishTrimmed>true</PublishTrimmed>
|
|||
|
@@ -10,7 +10,7 @@
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<PropertyGroup>
|
|||
|
- <SystemCommandLineDllPath Condition="'$(SystemCommandLineDllPath)'==''">..\..\..\System.CommandLine\bin\Release\net6.0\System.CommandLine.dll</SystemCommandLineDllPath>
|
|||
|
+ <SystemCommandLineDllPath Condition="'$(SystemCommandLineDllPath)'==''">..\..\..\System.CommandLine\bin\Release\$(TargetFrameworkForNETSDK)\System.CommandLine.dll</SystemCommandLineDllPath>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<ItemGroup>
|
|||
|
diff --git a/src/System.CommandLine/System.CommandLine.csproj b/src/System.CommandLine/System.CommandLine.csproj
|
|||
|
index 424053a6..37115d70 100644
|
|||
|
--- a/src/System.CommandLine/System.CommandLine.csproj
|
|||
|
+++ b/src/System.CommandLine/System.CommandLine.csproj
|
|||
|
@@ -3,7 +3,7 @@
|
|||
|
<PropertyGroup>
|
|||
|
<IsPackable>true</IsPackable>
|
|||
|
<PackageId>System.CommandLine</PackageId>
|
|||
|
- <TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
|
|||
|
+ <TargetFrameworks>$(TargetFrameworkForNETSDK);netstandard2.0</TargetFrameworks>
|
|||
|
<Nullable>enable</Nullable>
|
|||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|||
|
<LangVersion>10</LangVersion>
|
|||
|
@@ -15,9 +15,12 @@
|
|||
|
* Test and debug support
|
|||
|
</Description>
|
|||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|||
|
+ <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
|
|||
|
+ </PropertyGroup>
|
|||
|
+
|
|||
|
+ <PropertyGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkForNETSDK)'">
|
|||
|
<IsTrimmable>true</IsTrimmable>
|
|||
|
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
|
|||
|
- <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
|
|||
|
</PropertyGroup>
|
|||
|
|
|||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|