diff --git a/.azure-pipelines/build-job.yml b/.azure-pipelines/build-job.yml index 02c5233de2..1ac3ebb543 100644 --- a/.azure-pipelines/build-job.yml +++ b/.azure-pipelines/build-job.yml @@ -88,6 +88,8 @@ jobs: targetFramework: 'net6.0' NET8.0: targetFramework: 'net8.0' + NET9.0: + targetFramework: 'net9.0' ${{ if ne(parameters.container, '') }}: diff --git a/.azure-pipelines/pipeline.yml b/.azure-pipelines/pipeline.yml index cdb2d004ce..814f5dbd52 100644 --- a/.azure-pipelines/pipeline.yml +++ b/.azure-pipelines/pipeline.yml @@ -112,6 +112,8 @@ extends: targetFramework: 'net6.0' NET8.0: targetFramework: 'net8.0' + NET9.0: + targetFramework: 'net9.0' pool: name: 1ES-ABTT-Shared-Pool image: abtt-ubuntu-2204 diff --git a/.vsts.release.yml b/.vsts.release.yml index 396141213c..117c98b0d5 100644 --- a/.vsts.release.yml +++ b/.vsts.release.yml @@ -38,6 +38,7 @@ parameters: values: - net6.0 - net8.0 + - net9.0 - name: derivedFrom type: string displayName: Derived From Version @@ -149,9 +150,14 @@ extends: ## Verify target framework for specified version $majorVersion = $agentVersion.Split('.')[0] - if (("${{ parameters.targetFramework }}" -eq "net6.0" -and $majorVersion -ne "3") -or - ("${{ parameters.targetFramework }}" -eq "net8.0" -and $majorVersion -ne "4")) { - Write-Error "The major version should be 3 for net6.0 and 4 for net8.0" -ErrorAction Stop + if ( + ("${{ parameters.targetFramework }}" -eq "net6.0" -and $majorVersion -ne "3") -or + ( + ("${{ parameters.targetFramework }}" -eq "net8.0" -and $majorVersion -ne "4") -or + ("${{ parameters.targetFramework }}" -eq "net9.0" -and $majorVersion -ne "4") + ) + ) { + Write-Error "The major version should be 3 for net6.0 and 4 for net8.0 or net9.0" -ErrorAction Stop } } if ($isTestRun) { diff --git a/src/Agent.Plugins/TFCliManager.cs b/src/Agent.Plugins/TFCliManager.cs index cd9032967f..4ecfcd6a31 100644 --- a/src/Agent.Plugins/TFCliManager.cs +++ b/src/Agent.Plugins/TFCliManager.cs @@ -162,7 +162,9 @@ public void SetupProxy(string proxyUrl, string proxyUsername, string proxyPasswo public void SetupClientCertificate(string clientCert, string clientCertKey, string clientCertArchive, string clientCertPassword) { ArgUtil.File(clientCert, nameof(clientCert)); + #pragma warning disable SYSLIB0057 X509Certificate2 cert = new X509Certificate2(clientCert); + #pragma warning restore SYSLIB0057 ExecutionContext.Debug($"Set VstsClientCertificate={cert.Thumbprint} for Tf.exe to support client certificate."); AdditionalEnvironmentVariables["VstsClientCertificate"] = cert.Thumbprint; diff --git a/src/Agent.Sdk/AgentClientCertificateManager.cs b/src/Agent.Sdk/AgentClientCertificateManager.cs index 22a585201b..04ec6dad1b 100644 --- a/src/Agent.Sdk/AgentClientCertificateManager.cs +++ b/src/Agent.Sdk/AgentClientCertificateManager.cs @@ -35,7 +35,9 @@ public void AddClientCertificate(string clientCertificateArchiveFile, string cli { if (!string.IsNullOrEmpty(clientCertificateArchiveFile)) { + #pragma warning disable SYSLIB0057 _clientCertificates.Add(new X509Certificate2(clientCertificateArchiveFile, clientCertificatePassword)); + #pragma warning restore SYSLIB0057 } } } diff --git a/src/Agent.Worker/Build/TFCommandManager.cs b/src/Agent.Worker/Build/TFCommandManager.cs index f44f9fdbbe..8ac45ab747 100644 --- a/src/Agent.Worker/Build/TFCommandManager.cs +++ b/src/Agent.Worker/Build/TFCommandManager.cs @@ -159,7 +159,9 @@ public void SetupProxy(string proxyUrl, string proxyUsername, string proxyPasswo public void SetupClientCertificate(string clientCert, string clientCertKey, string clientCertArchive, string clientCertPassword) { ArgUtil.File(clientCert, nameof(clientCert)); + #pragma warning disable SYSLIB0057 X509Certificate2 cert = new X509Certificate2(clientCert); + #pragma warning restore SYSLIB0057 ExecutionContext.Debug($"Set VstsClientCertificate={cert.Thumbprint} for Tf.exe to support client certificate."); AdditionalEnvironmentVariables["VstsClientCertificate"] = cert.Thumbprint; diff --git a/src/Common.props b/src/Common.props index 8b1b645a91..acf2909500 100644 --- a/src/Common.props +++ b/src/Common.props @@ -1,7 +1,7 @@ 10.0 - net6.0;net8.0 + net6.0;net8.0;net9.0 $(PackageRuntime) true true diff --git a/src/dev.sh b/src/dev.sh index d292ac5106..b6907c06a7 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -47,12 +47,15 @@ function get_net_version() { net8.0-sdk=8.0.401 net8.0-runtime=8.0.8 + + net9.0-sdk=9.0.100 + net9.0-runtime=9.0.0 " echo "$dotnet_versions" | grep -o "$1=[^ ]*" | cut -d '=' -f2 } -DOTNET_SDK_VERSION=$(get_net_version "net8.0-sdk") +DOTNET_SDK_VERSION=$(get_net_version "${TARGET_FRAMEWORK}-sdk") DOTNET_RUNTIME_VERSION=$(get_net_version "${TARGET_FRAMEWORK}-runtime") if [[ ($DOTNET_SDK_VERSION == "") || ($DOTNET_RUNTIME_VERSION == "") ]]; then