From fb9c7f396a33bcabe160a2065ddec57fd1a38385 Mon Sep 17 00:00:00 2001 From: Next Turn <45985406+nxtn@users.noreply.github.com> Date: Sun, 29 Jan 2023 18:42:24 +0800 Subject: [PATCH] Upgrade to .NET 7 --- Directory.Build.targets | 2 +- eng/build.yml | 9 ++------- src/WinSW.Core/AssemblyInfo.cs | 8 +++++++- src/WinSW.Core/ILLink.Descriptors.xml | 5 +++++ src/WinSW.Core/WinSW.Core.csproj | 16 +++++++++++----- src/WinSW.Plugins/WinSW.Plugins.csproj | 9 ++++++--- src/WinSW.Tests/WinSW.Tests.csproj | 11 +++++++---- src/WinSW/Properties/AssemblyInfo.cs | 8 +++++++- src/WinSW/WinSW.csproj | 21 ++++++++++++++------- 9 files changed, 60 insertions(+), 29 deletions(-) create mode 100644 src/WinSW.Core/ILLink.Descriptors.xml diff --git a/Directory.Build.targets b/Directory.Build.targets index 93b21a9..612dce6 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,6 @@  - + VNEXT diff --git a/eng/build.yml b/eng/build.yml index a4b6b89..68d4eb9 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -26,11 +26,6 @@ strategy: Release: BuildConfiguration: Release steps: -- task: UseDotNet@2 - displayName: Install .NET SDK - inputs: - packageType: sdk - version: 6.x - task: DotNetCoreCLI@2 displayName: Build inputs: @@ -38,8 +33,8 @@ steps: projects: src\WinSW.sln arguments: -c $(BuildConfiguration) -p:Version=$(BuildVersion) - script: | - dotnet publish -c $(BuildConfiguration) -f net6.0-windows -r win-x64 src\WinSW\WinSW.csproj -p:Version=$(BuildVersion) - dotnet publish -c $(BuildConfiguration) -f net6.0-windows -r win-x86 src\WinSW\WinSW.csproj -p:Version=$(BuildVersion) + dotnet publish -c $(BuildConfiguration) -f net7.0-windows -r win-x64 --sc src\WinSW\WinSW.csproj -p:Version=$(BuildVersion) + dotnet publish -c $(BuildConfiguration) -f net7.0-windows -r win-x86 --sc src\WinSW\WinSW.csproj -p:Version=$(BuildVersion) displayName: Build - script: dotnet test -c $(BuildConfiguration) --collect "XPlat Code Coverage" --no-build src\WinSW.Tests\WinSW.Tests.csproj displayName: Test diff --git a/src/WinSW.Core/AssemblyInfo.cs b/src/WinSW.Core/AssemblyInfo.cs index 3e8e4d2..b24df4c 100644 --- a/src/WinSW.Core/AssemblyInfo.cs +++ b/src/WinSW.Core/AssemblyInfo.cs @@ -1,3 +1,9 @@ -using System.Runtime.CompilerServices; +#if NET +using System.Reflection; +#endif +using System.Runtime.CompilerServices; +#if NET +[assembly: AssemblyMetadata("IsTrimmable", "True")] +#endif [assembly: InternalsVisibleTo("WinSW")] diff --git a/src/WinSW.Core/ILLink.Descriptors.xml b/src/WinSW.Core/ILLink.Descriptors.xml new file mode 100644 index 0000000..11fc0a3 --- /dev/null +++ b/src/WinSW.Core/ILLink.Descriptors.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/WinSW.Core/WinSW.Core.csproj b/src/WinSW.Core/WinSW.Core.csproj index a438d2a..0b1693e 100644 --- a/src/WinSW.Core/WinSW.Core.csproj +++ b/src/WinSW.Core/WinSW.Core.csproj @@ -1,7 +1,7 @@  - net20;net40;net461;net6.0-windows + net20;net40;net461;net7.0-windows latest enable true @@ -18,12 +18,18 @@ - - - + + + - + + + ILLink.Descriptors.xml + + + + diff --git a/src/WinSW.Plugins/WinSW.Plugins.csproj b/src/WinSW.Plugins/WinSW.Plugins.csproj index 3c331a6..5dec5a0 100644 --- a/src/WinSW.Plugins/WinSW.Plugins.csproj +++ b/src/WinSW.Plugins/WinSW.Plugins.csproj @@ -1,14 +1,17 @@  - net20;net40;net461;net6.0-windows + net20;net40;net461;net7.0-windows latest enable true - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/WinSW.Tests/WinSW.Tests.csproj b/src/WinSW.Tests/WinSW.Tests.csproj index bd0ddc5..3afcb24 100644 --- a/src/WinSW.Tests/WinSW.Tests.csproj +++ b/src/WinSW.Tests/WinSW.Tests.csproj @@ -1,7 +1,7 @@  - net40;net461;net6.0-windows + net40;net461;net7.0-windows latest @@ -10,13 +10,16 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/WinSW/Properties/AssemblyInfo.cs b/src/WinSW/Properties/AssemblyInfo.cs index 46e0067..8a01a15 100644 --- a/src/WinSW/Properties/AssemblyInfo.cs +++ b/src/WinSW/Properties/AssemblyInfo.cs @@ -1,3 +1,9 @@ -using System.Runtime.CompilerServices; +#if NET +using System.Reflection; +#endif +using System.Runtime.CompilerServices; +#if NET +[assembly: AssemblyMetadata("IsTrimmable", "True")] +#endif [assembly: InternalsVisibleTo("Winsw.Tests")] diff --git a/src/WinSW/WinSW.csproj b/src/WinSW/WinSW.csproj index 9885557..f7288a4 100644 --- a/src/WinSW/WinSW.csproj +++ b/src/WinSW/WinSW.csproj @@ -2,11 +2,10 @@ Exe - net20;net40;net461;net6.0-windows + net20;net40;net461;net7.0-windows latest enable true - true Windows Service Wrapper Allows arbitrary process to run as a Windows service by wrapping it. @@ -15,15 +14,23 @@ Copyright (c) 2008-2020 Kohsuke Kawaguchi, Sun Microsystems, Inc., CloudBees, Inc., Oleg Nenashev and other contributors - + + true + partial + false + false + <_AggressiveAttributeTrimming>true + + + true - + 3.0.41 - + @@ -33,7 +40,7 @@ - + @@ -41,7 +48,7 @@ - + v2