From 50b01f937271788bdd01857709dc5950b1114728 Mon Sep 17 00:00:00 2001 From: Karol Zadora-Przylecki Date: Thu, 28 Mar 2024 17:17:12 -0700 Subject: [PATCH] Re-enables IDE protocol v1 support. Corresponding change in DCP will make it tolerate any combination of IDE tooling and app host libraries. That is, DCP will be able to use both old and new-style annotations and will probe the IDE for protocol supported, translating the requests as necessary. --- src/Aspire.Hosting/Dcp/ApplicationExecutor.cs | 29 +++++++++++++------ src/Aspire.Hosting/Dcp/DcpVersion.cs | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs b/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs index 49d90a9fd1..a0b2fa05f1 100644 --- a/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs +++ b/src/Aspire.Hosting/Dcp/ApplicationExecutor.cs @@ -1063,19 +1063,30 @@ private void PrepareProjectExecutables() { exeSpec.ExecutionType = ExecutionType.IDE; -#pragma warning disable CS0612 // These annotations are obsolete; remove in Aspire Preview 6 - annotationHolder.Annotate(Executable.CSharpProjectPathAnnotation, projectMetadata.ProjectPath); - - // ExcludeLaunchProfileAnnotation takes precedence over LaunchProfileAnnotation. - if (project.TryGetLastAnnotation(out _)) + if (_dcpInfo?.Version?.CompareTo(DcpVersion.MinimumVersionIdeProtocolV1) >= 0) { - annotationHolder.Annotate(Executable.CSharpDisableLaunchProfileAnnotation, "true"); + projectLaunchConfiguration.DisableLaunchProfile = project.TryGetLastAnnotation(out _); + if (!projectLaunchConfiguration.DisableLaunchProfile && project.TryGetLastAnnotation(out var lpa)) + { + projectLaunchConfiguration.LaunchProfile = lpa.LaunchProfileName; + } } - else if (project.TryGetLastAnnotation(out var lpa)) + else { - annotationHolder.Annotate(Executable.CSharpLaunchProfileAnnotation, lpa.LaunchProfileName); - } +#pragma warning disable CS0612 // These annotations are obsolete; remove in Aspire Preview 6 + annotationHolder.Annotate(Executable.CSharpProjectPathAnnotation, projectMetadata.ProjectPath); + + // ExcludeLaunchProfileAnnotation takes precedence over LaunchProfileAnnotation. + if (project.TryGetLastAnnotation(out _)) + { + annotationHolder.Annotate(Executable.CSharpDisableLaunchProfileAnnotation, "true"); + } + else if (project.TryGetLastAnnotation(out var lpa)) + { + annotationHolder.Annotate(Executable.CSharpLaunchProfileAnnotation, lpa.LaunchProfileName); + } #pragma warning restore CS0612 + } } else { diff --git a/src/Aspire.Hosting/Dcp/DcpVersion.cs b/src/Aspire.Hosting/Dcp/DcpVersion.cs index 22e3d74698..a8290757af 100644 --- a/src/Aspire.Hosting/Dcp/DcpVersion.cs +++ b/src/Aspire.Hosting/Dcp/DcpVersion.cs @@ -6,7 +6,7 @@ namespace Aspire.Hosting.Dcp; internal static class DcpVersion { public static Version MinimumVersionInclusive = new Version(0, 1, 55); - public static Version MinimumVersionIdeProtocolV1 = new Version(0, 1, 59); + public static Version MinimumVersionIdeProtocolV1 = new Version(0, 1, 61); /// /// Development build version proxy, considered always "current" and supporting latest features.