Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use obsolete X509Certificate2 ctor on .NET 9.0 #14935

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,11 @@ internal PublishArtifactsInManifestBase ConstructPublishingV3Task(BuildModel bui
SkipSafetyChecks = this.SkipSafetyChecks,
AkaMSClientId = this.AkaMSClientId,
AkaMSClientCertificate = !string.IsNullOrEmpty(AkaMSClientCertificate) ?
#if NET9_0_OR_GREATER
X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate)), password: null) : null,
#else
new X509Certificate2(Convert.FromBase64String(File.ReadAllText(AkaMSClientCertificate))) : null,
#endif
AkaMSCreatedBy = this.AkaMSCreatedBy,
AkaMSGroupOwner = this.AkaMSGroupOwner,
AkaMsOwners = this.AkaMsOwners,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
AkaMSLinkManager manager;
if (!string.IsNullOrEmpty(ClientCertificate))
{
#if NET9_0_OR_GREATER
manager = new AkaMSLinkManager(ClientId, X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(File.ReadAllText(ClientCertificate)), password: null), Tenant, Log);

Check failure on line 28 in src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs

View check run for this annotation

Azure Pipelines / arcade-pr (Build Linux Build_Debug)

src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs#L28

src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs(28,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'X509CertificateLoader' does not exist in the current context

Check failure on line 28 in src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs

View check run for this annotation

Azure Pipelines / arcade-pr

src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs#L28

src/Microsoft.DotNet.Deployment.Tasks.Links/src/AkaMSLinksBase.cs(28,58): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'X509CertificateLoader' does not exist in the current context
#else
manager = new AkaMSLinkManager(ClientId, new X509Certificate2(Convert.FromBase64String(File.ReadAllText(ClientCertificate))), Tenant, Log);
#endif
}
else if (!string.IsNullOrEmpty(ClientSecret))
{
Expand Down
Loading