From 3e4f3cac779fd6cb937e5b3987581e9460ee5e7a Mon Sep 17 00:00:00 2001 From: Coby Allred Date: Tue, 8 Oct 2024 08:38:36 -0700 Subject: [PATCH] Add .NET 8, FX 4.8.1 support (#520) With the end of support for multiple .NET releases used by the artifacts credential provider, it's time to migrate to supported .NET versions. This includes a bump of .NET 6 -> .NET 8 and .NET Framework 4.6.1 to .NET Framework 4.8.1. For more info on end of support dates, see https://github.com/dotnet/core/blob/main/releases.md These new bits will not be set as the default version being installed until the next major release as documented in the README. I'll also post an announcement about the upcoming deprecation. --------- Co-authored-by: Coby Allred --- Build.props | 4 +- CONTRIBUTING.md | 2 +- .../CredentialProvider.Microsoft.nuspec | 2 + README.md | 29 +++++-- build/build.yml | 80 ++++++++++++++++++- test.bat | 7 +- 6 files changed, 112 insertions(+), 12 deletions(-) diff --git a/Build.props b/Build.props index e972c7ac..672c292f 100644 --- a/Build.props +++ b/Build.props @@ -1,8 +1,8 @@ - 1.2.3 + 1.3.0 - netcoreapp3.1;net461;net6.0 + netcoreapp3.1;net461;net481;net6.0;net8.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59664ea9..77e61b72 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,7 +11,7 @@ In this and subsequent examples, configuration can be either `debug` or `release ### Publishing ```shell -dotnet publish CredentialProvider.Microsoft --configuration Release --framework net6.0 +dotnet publish CredentialProvider.Microsoft --configuration Release --framework net8.0 ``` ### Packing diff --git a/CredentialProvider.Microsoft/CredentialProvider.Microsoft.nuspec b/CredentialProvider.Microsoft/CredentialProvider.Microsoft.nuspec index 3bc6587c..c761df78 100644 --- a/CredentialProvider.Microsoft/CredentialProvider.Microsoft.nuspec +++ b/CredentialProvider.Microsoft/CredentialProvider.Microsoft.nuspec @@ -18,7 +18,9 @@ + + diff --git a/README.md b/README.md index df5db32f..329ccee8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ The Azure Artifacts Credential Provider automates the acquisition of credentials - [Session Token Cache Locations](#session-token-cache-locations) - [Environment Variables](#environment-variables) - [Release version 1.0.0](#release-version-1.0.0) +- [Upcoming version 2.0.0](#release-version-2.0.0) - [Help](#help) - [Contribute](#contribute) @@ -25,7 +26,7 @@ Install [Visual Studio version 15.9-preview1 or later](https://visualstudio.micr ### dotnet -The default installation requires the [dotnet Runtime](https://www.microsoft.com/net/download) version `6.0.x` or later. +The default installation requires the [dotnet runtime](https://www.microsoft.com/net/download) version `8.0.x` or later. ## Setup @@ -164,6 +165,17 @@ Release version [1.0.0](https://github.com/microsoft/artifacts-credprovider/rele [1.0.0 release](https://github.com/microsoft/artifacts-credprovider/releases/tag/v1.0.0) also publishes the credential provider for .NET 6 users as `Microsoft.Net6.NuGet.CredentialProvider`. +## Release version 2.0.0 + +Release version 2.0.0 will be the next major version of artifacts-credprovider and will contain changes which end support for various .NET versions which have reached their end of support. It is planned for release in Q1 2025 to allow users to migrate their usage of the tool to the new .NET versions. + +- .NET Framework 4.6.1 (End of Support April 26, 2022) - Replaced with .NET Framework 4.8.1 +- .NET Core 3.1 (End of Support December 13, 2022) - Replaced with .NET 6/8 + +.NET 6 will reach its end of support on November 12, 2024. After v2.0.0 is released, a minor version of artifacts-credprovider will be published to deprecate .NET 6 compatible binaries. + +- .NET 6 (End of Support November 12, 2024) - Replaced with .NET 8 + ## Help The windows plugin, delivered in the `netfx` folder of `Microsoft.NuGet.CredentialProvider.zip`, ships a stand-alone executable that will acquire credentials. This program will place the credentials in the same location that the .dll would if it were called by nuget.exe, dotnet.exe, or msbuild.exe. The stand-alone executable will also print the available command options, environment variables, and credential storage locations. This information is reproduced here: @@ -305,12 +317,19 @@ Run the credential provider directly with the following command: `C:\Users\ .NET Core 3.1 and .NET Framework 4.6.1 compatability will also be removed from major version 2.0.0. See the announcement [here](https://github.com/microsoft/artifacts-credprovider/discussions/386). -> .NET Core 3.1 will also be removed from future versions. See the announcement [here](https://github.com/microsoft/artifacts-credprovider/discussions/386). +To keep using .NET versions which are past their end of support date, see the table below for the maximum Artifacts Credential Provider version. -If you keep using the unsupported .NET Core 2.1 you must use Artifacts Credential Provider version 0.1.28 or lower. +| .NET Version | End of ACP Support | +| -------- | ------- | +| .NET Core 2.1 | 0.1.28 | +| .NET Core 3.1 | 1.x.x (pending final release) | +| .NET Framework 4.6.1 | 1.x.x (pending final release) | +| .NET 6.0 | 2.x.x (pending release) | ## Contribute diff --git a/build/build.yml b/build/build.yml index 0704b800..d515be32 100644 --- a/build/build.yml +++ b/build/build.yml @@ -10,11 +10,17 @@ steps: version: 3.1.x - task: UseDotNet@2 - displayName: Use .NET 6 SDK + displayName: Use .NET 6 runtime inputs: - packageType: sdk + packageType: runtime version: 6.x +- task: UseDotNet@2 + displayName: Use .NET 8 SDK + inputs: + packageType: sdk + version: 8.x + - task: NuGetToolInstaller@1 displayName: NuGet Install @@ -55,10 +61,10 @@ steps: - script: dotnet test MicrosoftCredentialProvider.sln --logger trx --results-directory $(Agent.TempDirectory) displayName: dotnet test +# Create .NET 6.0 release for netcore users - script: dotnet publish CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj --no-build --framework net6.0 --configuration $(BuildConfiguration) -p:${{ parameters.nuspecProperties }} displayName: dotnet publish net6.0 -# Create .NET 6.0 release for netcore users - task: CopyFiles@2 displayName: Copy net6.0 files into tarball inputs: @@ -96,6 +102,47 @@ steps: archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.Net6.NuGet.CredentialProvider.zip' replaceExistingArchive: true +# Clean target folder and create .NET 8.0 release for netcore users +- script: dotnet publish CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj --no-build --framework net8.0 --configuration $(BuildConfiguration) -p:${{ parameters.nuspecProperties }} + displayName: dotnet publish net8.0 + +- task: CopyFiles@2 + displayName: Copy net8.0 files into tarball + inputs: + sourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)\net8.0\publish\' + contents: '**\*' + targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\plugins\netcore\CredentialProvider.Microsoft\' + cleanTargetFolder: true + +- task: CopyFiles@2 + displayName: Copy license files into tarball + inputs: + contents: | + LICENSE + CredentialProvider.Microsoft\EULA_Microsoft Visual Studio Team Services Credential Provider.docx + CredentialProvider.Microsoft\ThirdPartyNotices.txt + targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\' + flattenFolders: true + +- task: ArchiveFiles@2 + displayName: Create net8.0 tarball + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\' + includeRootFolder: false + archiveType: 'tar' + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.Net8.NuGet.CredentialProvider.tar.gz' + replaceExistingArchive: true + +- task: ArchiveFiles@2 + displayName: Create net8.0 zip + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.Net8.NuGet.CredentialProvider.zip' + replaceExistingArchive: true + # Clean target folder and create netcore 3.1 and netfx releases - script: dotnet publish CredentialProvider.Microsoft/CredentialProvider.Microsoft.csproj --no-build --framework netcoreapp3.1 --configuration $(BuildConfiguration) -p:${{ parameters.nuspecProperties }} displayName: dotnet publish netcoreapp3.1 @@ -165,6 +212,33 @@ steps: archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NuGet.CredentialProvider.zip' replaceExistingArchive: true +- task: CopyFiles@2 + displayName: Copy netfx 4.8.1 files into tarball + inputs: + sourceFolder: '$(Build.SourcesDirectory)\CredentialProvider.Microsoft\bin\$(BuildConfiguration)\net481\' + contents: '**\*' + targetFolder: '$(Build.ArtifactStagingDirectory)\tarball\plugins\netfx\CredentialProvider.Microsoft\' + cleanTargetFolder: true + +- task: ArchiveFiles@2 + displayName: Create netfx 4.8.1 tarball + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\' + includeRootFolder: false + archiveType: 'tar' + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NetFx48.NuGet.CredentialProvider.tar.gz' + replaceExistingArchive: true + +- task: ArchiveFiles@2 + displayName: Create netfx 4.8.1 zip + inputs: + rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\tarball\' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\Microsoft.NetFx48.NuGet.CredentialProvider.zip' + replaceExistingArchive: true + - task: CopyFiles@2 displayName: Collect symbols inputs: diff --git a/test.bat b/test.bat index 1825b6ca..f13e9932 100644 --- a/test.bat +++ b/test.bat @@ -4,6 +4,11 @@ SETLOCAL EnableDelayedExpansion @REM A Windows domain user should be able to run this against a feed in an AAD-back AzDO org @REM and all scenarios should succeed non-interactively. +IF "%~1" == "" ( + echo "Please specify an AzDO organization package feed URL as the first parameter." + exit /b 1 +) + set TEST_FEED=%1 set NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_ENABLED=true set NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION=%TEMP%\msal.cache @@ -30,7 +35,7 @@ exit /b 0 :TEST_FRAMEWORKS -for %%I in ("netcoreapp3.1","net461","net6.0") DO ( +for %%I in ("netcoreapp3.1","net461","net481","net6.0","net8.0") DO ( del /q "!UserProfile!\AppData\Local\MicrosoftCredentialProvider\*.dat" 2>NUL del /q "%NUGET_CREDENTIALPROVIDER_MSAL_FILECACHE_LOCATION%" 2>NUL echo Testing %%I with NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER=!NUGET_CREDENTIALPROVIDER_MSAL_ALLOW_BROKER!