From e6e2672481e09d420b9839e38ce4a3d641a7cacd Mon Sep 17 00:00:00 2001 From: Andy Gerlicher Date: Thu, 26 Sep 2024 09:00:18 -0700 Subject: [PATCH 1/3] Upgrade to net9.0-rc --- Directory.Build.props | 2 + Directory.Build.targets | 24 +++++++++ Directory.Packages.props | 34 ++++++------ azure-pipelines-official.yml | 38 +++++++------ azure-pipelines.yml | 53 ++----------------- global.json | 2 +- .../Microsoft.VisualStudio.SlnGen.Tool.csproj | 30 +---------- ...osoft.VisualStudio.SlnGen.UnitTests.csproj | 4 +- .../TestBase.cs | 8 +-- .../Microsoft.VisualStudio.SlnGen.csproj | 9 +--- .../Microsoft.VisualStudio.SlnGen.targets | 20 +++---- src/SlnGen.Corext/SlnGen.Corext.csproj | 2 +- 12 files changed, 85 insertions(+), 141 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 5eeb8775..86a6b58a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,5 +11,7 @@ true $(NoWarn);NETSDK1213 true + true + false diff --git a/Directory.Build.targets b/Directory.Build.targets index 09245a9f..822971f8 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -105,4 +105,28 @@ Condition="'$(VsSDKVersion)' != ''" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index b3b8a0f9..c34d8059 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,35 +6,39 @@ true - 17.8.3 - 15.9.20 - 17.3.2 - 17.7.2 + 17.11.4 + 16.11.0 8.0.0 - 6.0.0 8.0.0 - 6.0.0 + 6.0.0 - + - - + + - - + + - + - - + + + + + + + + + @@ -43,4 +47,4 @@ - + \ No newline at end of file diff --git a/azure-pipelines-official.yml b/azure-pipelines-official.yml index ff85de62..e2879b66 100644 --- a/azure-pipelines-official.yml +++ b/azure-pipelines-official.yml @@ -9,10 +9,6 @@ variables: ArtifactsDirectory: artifacts BuildConfiguration: 'Release' BuildPlatform: 'Any CPU' - DotNet6Version: '6.x' - DotNet7Version: '7.x' - DotNet8Version: '8.x' - DotNet9Version: '9.x' MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"' SignType: 'Test' trigger: @@ -81,24 +77,32 @@ extends: displayName: 'Set SignType to Real for tagged commits' condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet6Version)' + displayName: 'Install .NET 8.x' inputs: - version: '$(DotNet6Version)' + version: '8.x' - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet7Version)' + displayName: 'Install .NET 9.x' inputs: - version: '$(DotNet7Version)' - - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet8Version)' - inputs: - version: '$(DotNet8Version)' - - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet9Version)' - inputs: - version: '$(DotNet9Version)' + version: '9.x' includePreviewVersions: true - task: VSBuild@1 displayName: 'Build Solution' inputs: solution: '**\*.sln' - msbuildArgs: '$(MSBuildArgs)' \ No newline at end of file + msbuildArgs: '$(MSBuildArgs)' + - task: AzureCLI@2 + displayName: 'Push SlnGen.Corext' + inputs: + azureSubscription: 'CloudBuild-Push-v2' + scriptType: 'pscore' + scriptLocation: 'inlineScript' + inlineScript: | + # Get an access token for Azure DevOp (resource id is for AzDO) + $accessToken = az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 -o tsv + + # Set the access token as a secret, so it doesn't get leaked in the logs + Write-Host "##vso[task.setsecret]$accessToken" + + # Override the apitoken of the nuget service connection, for the duration of this stage + # Service connection is for "microsoft.slngen Official" + Write-Host "##vso[task.setendpoint id=d8767bc1-a109-4cb7-80c2-6ac1ebf4346e;field=authParameter;key=apitoken]$accessToken" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b0e20aca..722faf30 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,12 +5,6 @@ variables: ArtifactsDirectoryName: 'artifacts' BuildConfiguration: 'Debug' BuildPlatform: 'Any CPU' - DotNet6Version: '6.x' - DotNet7Version: '7.x' - DotNet8Version: '8.x' - DotNet9Version: '9.x' - # Not using "--channel 9.0 --quality daily", see https://github.com/microsoft/slngen/issues/456 - DotNet9InstallArgs: '-version 9.0.100-alpha.1.23528.2' MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)"' SignType: 'Test' @@ -50,39 +44,16 @@ jobs: vmImage: $(vmImage) steps: - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet6Version)' + displayName: 'Install .NET 8.x' inputs: - version: '$(DotNet6Version)' + version: '8.x' - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet7Version)' + displayName: 'Install .NET 9.x' inputs: - version: '$(DotNet7Version)' - - - task: UseDotNet@2 - displayName: 'Install .NET $(DotNet8Version)' - inputs: - version: '$(DotNet8Version)' + version: '9.x' includePreviewVersions: true - - script: | - powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) $(DotNet9InstallArgs) -InstallDir C:\hostedtoolcache\windows\dotnet" - dotnet --info - displayName: 'Install .NET $(DotNet9Version) (Windows)' - condition: eq(variables.osName, 'Windows') - - - script: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet9InstallArgs) --install-dir /opt/hostedtoolcache/dotnet - dotnet --info - displayName: 'Install .NET $(DotNet9Version) (Linux)' - condition: eq(variables.osName, 'Linux') - - - script: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet9InstallArgs) --install-dir /Users/runner/hostedtoolcache/dotnet - dotnet --info - displayName: 'Install .NET $(DotNet9Version) (MacOS)' - condition: eq(variables.osName, 'MacOS') - - task: VSBuild@1 displayName: 'Build (Visual Studio)' inputs: @@ -104,22 +75,6 @@ jobs: testRunTitle: '$(osName) .NET Framework v4.7.2' condition: and(succeededOrFailed(), eq(variables.osName, 'Windows')) - - task: DotNetCoreCLI@2 - displayName: 'Run Unit Tests (.NET 6)' - inputs: - command: 'test' - arguments: '--no-restore --no-build --framework net6.0 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-net6.0.binlog"' - testRunTitle: '$(osName) .NET 6.0' - condition: succeededOrFailed() - - - task: DotNetCoreCLI@2 - displayName: 'Run Unit Tests (.NET 7)' - inputs: - command: 'test' - arguments: '--no-restore --no-build --framework net7.0 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-net7.0.binlog"' - testRunTitle: '$(osName) .NET 7.0' - condition: succeededOrFailed() - - task: DotNetCoreCLI@2 displayName: 'Run Unit Tests (.NET 8)' inputs: diff --git a/global.json b/global.json index 43a878ce..33fcda4e 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.0", + "version": "9.0.100-rc.1.24452.12", "rollForward": "latestMajor", "allowPrerelease": true }, diff --git a/src/Microsoft.VisualStudio.SlnGen.Tool/Microsoft.VisualStudio.SlnGen.Tool.csproj b/src/Microsoft.VisualStudio.SlnGen.Tool/Microsoft.VisualStudio.SlnGen.Tool.csproj index 44c7564f..3dfa3042 100644 --- a/src/Microsoft.VisualStudio.SlnGen.Tool/Microsoft.VisualStudio.SlnGen.Tool.csproj +++ b/src/Microsoft.VisualStudio.SlnGen.Tool/Microsoft.VisualStudio.SlnGen.Tool.csproj @@ -1,12 +1,11 @@  Exe - net6.0 + net8.0 true slngen LatestMajor <_GetChildProjectCopyToPublishDirectoryItems>false - true @@ -15,14 +14,6 @@ StrongName="StrongName" /> - - - + TargetFramework="net9.0" /> - true - net472;net6.0;net7.0;net8.0 - $(TargetFrameworks);net9.0 + net472;net8.0;net9.0 false $(NoWarn);SA1600 diff --git a/src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs b/src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs index ac0c3922..1ae8db70 100644 --- a/src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs +++ b/src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs @@ -11,13 +11,9 @@ namespace Microsoft.VisualStudio.SlnGen.UnitTests public abstract class TestBase : MSBuildTestBase { private const string DotNetSdkVersion = -#if NET6_0 - "6.0.0"; -#elif NET7_0 || NETFRAMEWORK - "7.0.0"; -#elif NET8_0 +#if NET8_0 "8.0.0"; -#elif NET9_0 +#elif NET9_0 || NETFRAMEWORK "9.0.0"; #else Unknown target framework diff --git a/src/Microsoft.VisualStudio.SlnGen/Microsoft.VisualStudio.SlnGen.csproj b/src/Microsoft.VisualStudio.SlnGen/Microsoft.VisualStudio.SlnGen.csproj index aa745b77..f0128d2a 100644 --- a/src/Microsoft.VisualStudio.SlnGen/Microsoft.VisualStudio.SlnGen.csproj +++ b/src/Microsoft.VisualStudio.SlnGen/Microsoft.VisualStudio.SlnGen.csproj @@ -1,9 +1,7 @@  - true Exe - net461;net472;net6.0;net7.0;net8.0 - $(TargetFrameworks);net9.0 + net472;net8.0;net9.0 $(AllowedOutputExtensionsInPackageBuildOutputFolder);.config true true @@ -28,14 +26,11 @@ - - - - +