diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs index 8599fb00d82..950220c363d 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifest.cs @@ -361,9 +361,11 @@ internal PublishArtifactsInManifestBase ConstructPublishingV3Task(BuildModel bui SkipSafetyChecks = this.SkipSafetyChecks, AkaMSClientId = this.AkaMSClientId, AkaMSClientCertificate = !string.IsNullOrEmpty(AkaMSClientCertificate) ? -#pragma warning disable SYSLIB0057 // https://github.com/dotnet/arcade/issues/14936 +#if NET9_0_OR_GREATER + X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate)), password: null) : null, +#else new X509Certificate2(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate))) : null, -#pragma warning restore +#endif AkaMSCreatedBy = this.AkaMSCreatedBy, AkaMSGroupOwner = this.AkaMSGroupOwner, AkaMsOwners = this.AkaMsOwners, diff --git a/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs b/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs index 927d5037a71..77a64125333 100644 --- a/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs +++ b/src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs @@ -24,9 +24,11 @@ protected AkaMSLinkManager CreateAkaMSLinksManager() AkaMSLinkManager manager; if (!string.IsNullOrEmpty(ClientCertificate)) { -#pragma warning disable SYSLIB0057 // https://github.com/dotnet/arcade/issues/14936 +#if NET9_0_OR_GREATER + manager = new AkaMSLinkManager(ClientId, X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(ClientCertificate)), password: null), Tenant, Log); +#else manager = new AkaMSLinkManager(ClientId, new X509Certificate2(Convert.FromBase64String(File.ReadAllText(ClientCertificate))), Tenant, Log); -#pragma warning restore +#endif } else if (!string.IsNullOrEmpty(ClientSecret)) {