diff --git a/docs/specs/future-of-workload.md b/docs/specs/future-of-workload.md new file mode 100644 index 0000000000..c73ee26117 --- /dev/null +++ b/docs/specs/future-of-workload.md @@ -0,0 +1,33 @@ +# Design proposal for the .NET Aspire workload going forward + +.NET Aspire currently ships as a .NET SDK Workload. This workload currently includes the following components: + +- Aspire.Hosting.SDK (MSBuild SDK): This SDK contains some props and targets with the required logic to properly handle `ProjectReferences` in the .NET Aspire AppHost projects, which then drives the source generation that allows the AppHost project to have strongly typed references to project resources. This component cannot be changed into a regular NuGet package, as the logic it carries neeeds to be executed before the initial restore. +- Aspire.ProjectTemplates (.NET Template Pack): This is a set of project templates that allow users to create new .NET Aspire projects using `dotnet new` commands and Visual Studio "New Project" dialog. +- Aspire.Hosting.Orchestration (MSBuild SDK): This SDK contains two main things: the Developer Control Plane executable (DCP) as well as a targets file which defines properties for the AppHost to be able to find the DCP executable and run it. +- Aspire.Dashboard.SDK (MSBuild SDK): Similar to the Orchestration SDK, this one provides the .NET Aspire Dashboard application (self-contained app that depends on .NET 8 runtime) and the targets file that defines properties for the AppHost to be able to find the Dashboard executable and launch it. +- Aspire.Hosting (Regular NuGet Library): This package isn't really required to be in the workload, as this is a PackageReference that all AppHost projects will have. The advantage that we get currently from having it in the workload is that this would install it into the global NuGet cache when the workload is installed, so that the AppHost projects can find it without needing to restore it from the NuGet feed. This is helpful especially for offline scenarios. The package itself provides the Aspire.Hosting library which contains all of the main logic in Aspire for building and running .NET Aspire applications. + +## Problem statement + +The current design of the workload has led to some usability issues, and after a lot of deep analysis, we finally understand what is the root cause of these issues. SDK Workloads are meant to be used for tooling components, which lifetime should be tied to the lifetime of the SDK itself. When we were originally designing the workload, we believed that both DCP and Dashboard were tooling components, and that they should be installed as part of the workload. However, we have come to realize that this is not the case. DCP and Dashboard are tightly coupled to the version of Aspire.Hosting package that the AppHost project references, and therefore are part of the AppHost itself, as opposed to tooling that supports it. This is the root cause of the issues that we have seen with the workload, such as the need to ensure that the version of the workload installed matches the project reference of Aspire.Hosting, which is also a problem when trying to work with multiple Aspire projects that reference different versions of Aspire.Hosting. SDK typically makes the assumption that customers want to always be in the latest version of all of the workloads, which is likely the right thing to do for tooling components; however, this is a problem for .NET Aspire given the tight coupling between the AppHost and the DCP/Dashboard. + +## Proposed solution + +Given the above, we propose to move the DCP and Dashboard components out of the workload, and into NuGet packages that are dynamically referenced by the Aspire.Hosting.SDK. This will allow the AppHost project to reference the version of Aspire.Hosting that it wants, and then the DCP and Dashboard will be referenced automatically by the Aspire SDK as dependencies of that version of Aspire.Hosting. This will allow the AppHost project to have full control over the version of the DCP and Dashboard that it wants to use, and will also allow customers to have multiple AppHost projects that reference different versions of Aspire.Hosting without any issues. This will also allow us to update the DCP and Dashboard independently of the workload, which will allow us to ship updates to these components more frequently and with less risk, with a far less complex compatibility matrix. + +Also, there is no real need of including the Aspire.Hosting package as part of the workload, as there is no guarantee that this is the version that the AppHost project will want to use, therefore we would also remove this package from the workload. In the end, the workload will only contain the Aspire.Hosting.SDK and Aspire.ProjectTemplates components, which are the ones that can be truly considered as tooling components, and in both cases you would want to always be in the latest version. These two are also not tightly coupled to the version of the Aspire.Hosting package that the AppHost project references, so they can be updated independently of the AppHost. + +### Pros + +This proposal has many benefits which will solve the issues we currently have with the workload: + +- The AppHost project will have full control over the version of the DCP and Dashboard that it wants to use. +- Customers can have multiple AppHost projects that reference different versions of Aspire.Hosting without any issues. +- We can update the DCP and Dashboard independently of the workload, which will allow us to ship updates to these components more frequently and with less risk. +- Customers can stay in the latest version of the workload without worrying about compatibility issues with the AppHost project. +- Because Aspire.Hosting.SDK targets get imported before the initial restore, we can still have the same experience as before, where the AppHost project will end up restoring only the DCP and Dashboard packages for the platform that is being targeted, as opposed to needing to restore them for all platforms. + +### Cons + +- Workloads have a way of keeping a reference count on workload packs, so it is able to clean them up when workloads don't reference it any more (for example, if you update your workload, then the old DCP package will be cleaned up automatically). This doesn't happen with regular NuGet packages, where customers are responsible for cleaning up their NuGet package caches themselves. \ No newline at end of file diff --git a/eng/Build.props b/eng/Build.props index fe58cc293c..86ed7c175c 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,8 +1,10 @@ - + + + diff --git a/eng/Versions.props b/eng/Versions.props index 3af3246eea..0bdbddc6a9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -2,9 +2,9 @@ 8 - 1 - 1 - 8.1.1 + 2 + 0 + 8.2.0 preview.1 + + true + true + false + $(ArtifactsShippingPackagesDir) + + + + Dashboard browser interface for .NET Aspire. + + + + + + + + + + + + + + + + + + + + + + <_PublishItems + Include="$(DotNetOutputPath)Aspire.Dashboard/$(DashboardRuntime)/$(Configuration)/$(TargetFramework)/$(DashboardRuntime)/publish/**/*" /> + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/dashboardpack/Sdk.targets b/eng/dashboardpack/Sdk.in.targets similarity index 84% rename from eng/dashboardpack/Sdk.targets rename to eng/dashboardpack/Sdk.in.targets index f903ca475d..4af9f8fb1c 100644 --- a/eng/dashboardpack/Sdk.targets +++ b/eng/dashboardpack/Sdk.in.targets @@ -2,7 +2,7 @@ - + $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'tools')) $([MSBuild]::EnsureTrailingSlash('$(AspireDashboardDir)')) $([MSBuild]::NormalizePath($(AspireDashboardDir), 'Aspire.Dashboard')) @@ -10,7 +10,7 @@ $(AspireDashboardPath).dll - + diff --git a/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.props b/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.props new file mode 100644 index 0000000000..05c5e5a2cc --- /dev/null +++ b/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.targets b/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.targets new file mode 100644 index 0000000000..f03803b10b --- /dev/null +++ b/eng/dashboardpack/buildMultiTargeting/Aspire.Dashboard.Sdk.in.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.props b/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.props new file mode 100644 index 0000000000..05c5e5a2cc --- /dev/null +++ b/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.targets b/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.targets new file mode 100644 index 0000000000..f03803b10b --- /dev/null +++ b/eng/dashboardpack/buildTransitive/Aspire.Dashboard.Sdk.in.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/dashboardpack/dashboardpack.csproj b/eng/dashboardpack/dashboardpack.csproj deleted file mode 100644 index 6153abb0b3..0000000000 --- a/eng/dashboardpack/dashboardpack.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - net8.0 - true - true - true - false - $(ArtifactsShippingPackagesDir) - - - - Aspire.Dashboard.Sdk.$(DashboardRuntime) - Dashboard browser interface for .NET Aspire. - - - - Windows - Unix - - - - - - - - - - - - <_PublishItems Include="$(DotNetOutputPath)Aspire.Dashboard/$(DashboardRuntime)/$(Configuration)/$(TargetFramework)/$(DashboardRuntime)/publish/**/*" /> - - - - - - - - - - - - - - - - - diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.targets b/eng/dcppack/Aspire.Hosting.Orchestration.in.targets similarity index 91% rename from eng/dcppack/Aspire.Hosting.Orchestration.targets rename to eng/dcppack/Aspire.Hosting.Orchestration.in.targets index ad698ca042..23524cc8d5 100644 --- a/eng/dcppack/Aspire.Hosting.Orchestration.targets +++ b/eng/dcppack/Aspire.Hosting.Orchestration.in.targets @@ -1,6 +1,6 @@ - + $([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'tools')) $([MSBuild]::EnsureTrailingSlash('$(DcpDir)')) $([MSBuild]::NormalizeDirectory($(DcpDir), 'ext')) diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.linux-arm64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.linux-arm64.csproj new file mode 100644 index 0000000000..6514a3258d --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.linux-arm64.csproj @@ -0,0 +1,9 @@ + + + linux-arm64 + Unix + + + + + \ No newline at end of file diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.linux-x64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.linux-x64.csproj new file mode 100644 index 0000000000..b75905a392 --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.linux-x64.csproj @@ -0,0 +1,9 @@ + + + linux-x64 + Unix + + + + + diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.osx-arm64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.osx-arm64.csproj new file mode 100644 index 0000000000..ceeb0754cf --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.osx-arm64.csproj @@ -0,0 +1,9 @@ + + + osx-arm64 + Unix + + + + + diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.osx-x64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.osx-x64.csproj new file mode 100644 index 0000000000..597408d445 --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.osx-x64.csproj @@ -0,0 +1,9 @@ + + + osx-x64 + Unix + + + + + diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.props b/eng/dcppack/Aspire.Hosting.Orchestration.props deleted file mode 100644 index c1df2220dd..0000000000 --- a/eng/dcppack/Aspire.Hosting.Orchestration.props +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.win-arm64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.win-arm64.csproj new file mode 100644 index 0000000000..db3f0de0e2 --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.win-arm64.csproj @@ -0,0 +1,9 @@ + + + win-arm64 + Windows + + + + + diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.win-x64.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.win-x64.csproj new file mode 100644 index 0000000000..d7d2a23147 --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.win-x64.csproj @@ -0,0 +1,9 @@ + + + win-x64 + Windows + + + + + diff --git a/eng/dcppack/Aspire.Hosting.Orchestration.win-x86.csproj b/eng/dcppack/Aspire.Hosting.Orchestration.win-x86.csproj new file mode 100644 index 0000000000..f2901f60a9 --- /dev/null +++ b/eng/dcppack/Aspire.Hosting.Orchestration.win-x86.csproj @@ -0,0 +1,9 @@ + + + win-x86 + Windows + + + + + diff --git a/eng/dcppack/dcppack.csproj b/eng/dcppack/Common.projitems similarity index 76% rename from eng/dcppack/dcppack.csproj rename to eng/dcppack/Common.projitems index 76235ec145..7a01c1815c 100644 --- a/eng/dcppack/dcppack.csproj +++ b/eng/dcppack/Common.projitems @@ -6,6 +6,8 @@ net8.0 true + + true true false @@ -14,10 +16,7 @@ - win-x64 $([System.String]::Copy('$(DcpRuntime)').Replace('win-', 'windows-').Replace('osx-', 'darwin-').Replace('-x86', '-386').Replace('-x64', '-amd64')) - Windows - Unix @@ -25,6 +24,15 @@ .NET Aspire Orchestration Dependencies + + + + + + + + + @@ -40,6 +48,12 @@ + + + $(NuGetPackageRoot)microsoft.developercontrolplane.$(DcpPlatform)/$(MicrosoftDeveloperControlPlanedarwinamd64PackageVersion)/tools + + + <_DcpNuGetRootPath>$(NuGetPackageRoot)microsoft.developercontrolplane.$(DcpPlatform)/$(MicrosoftDeveloperControlPlanedarwinamd64PackageVersion)/tools @@ -53,15 +67,8 @@ - - - - + - - - - diff --git a/eng/dcppack/Sdk.in.targets b/eng/dcppack/Sdk.in.targets deleted file mode 100644 index f5beae6898..0000000000 --- a/eng/dcppack/Sdk.in.targets +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/eng/dcppack/Sdk.props b/eng/dcppack/Sdk.props deleted file mode 100644 index c1df2220dd..0000000000 --- a/eng/dcppack/Sdk.props +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/eng/dcppack/buildMultiTargeting/Aspire.Hosting.Orchestration.in.targets b/eng/dcppack/buildMultiTargeting/Aspire.Hosting.Orchestration.in.targets new file mode 100644 index 0000000000..f03803b10b --- /dev/null +++ b/eng/dcppack/buildMultiTargeting/Aspire.Hosting.Orchestration.in.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/dcppack/buildTransitive/Aspire.Hosting.Orchestration.in.targets b/eng/dcppack/buildTransitive/Aspire.Hosting.Orchestration.in.targets new file mode 100644 index 0000000000..f03803b10b --- /dev/null +++ b/eng/dcppack/buildTransitive/Aspire.Hosting.Orchestration.in.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/eng/workloads/workloads.csproj b/eng/workloads/workloads.csproj index 7318c8a049..d65caa3dcf 100644 --- a/eng/workloads/workloads.csproj +++ b/eng/workloads/workloads.csproj @@ -73,9 +73,6 @@ - - - + diff --git a/src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.targets b/src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.targets index 4d159721f7..515139a426 100644 --- a/src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.targets +++ b/src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.targets @@ -246,6 +246,12 @@ namespace Projects%3B + + + + diff --git a/src/Aspire.Hosting.Sdk/Aspire.Hosting.Sdk.csproj b/src/Aspire.Hosting.Sdk/Aspire.Hosting.Sdk.csproj index 1a62f5a917..ee8eaa6c1f 100644 --- a/src/Aspire.Hosting.Sdk/Aspire.Hosting.Sdk.csproj +++ b/src/Aspire.Hosting.Sdk/Aspire.Hosting.Sdk.csproj @@ -13,7 +13,8 @@ - + + diff --git a/src/Aspire.Hosting.Sdk/SDK/Sdk.in.props b/src/Aspire.Hosting.Sdk/SDK/Sdk.in.props new file mode 100644 index 0000000000..15242e18dc --- /dev/null +++ b/src/Aspire.Hosting.Sdk/SDK/Sdk.in.props @@ -0,0 +1,5 @@ + + + @VERSION@ + + \ No newline at end of file diff --git a/src/Aspire.Hosting.Sdk/SDK/Sdk.props b/src/Aspire.Hosting.Sdk/SDK/Sdk.props deleted file mode 100644 index 058246e408..0000000000 --- a/src/Aspire.Hosting.Sdk/SDK/Sdk.props +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Aspire.Hosting.Sdk/SDK/Sdk.targets b/src/Aspire.Hosting.Sdk/SDK/Sdk.targets index 5dadacf794..81e5119481 100644 --- a/src/Aspire.Hosting.Sdk/SDK/Sdk.targets +++ b/src/Aspire.Hosting.Sdk/SDK/Sdk.targets @@ -1,9 +1,11 @@ @@ -13,34 +15,92 @@ - + false false - + true - false - true - all + + false + + true + + all false - + - - + + + + + + - - + + + + + + <_AppHostPackageReference Include="@(PackageReference)" Condition="'%(Identity)' == + 'Aspire.Hosting.AppHost'" /> + + + + + <_AppHostVersion>%(_AppHostPackageReference.Version) + + + + + <_AppHostPackageReference /> + <_AppHostPackageReference Include="@(PackageVersion)" Condition="'%(Identity)' == + 'Aspire.Hosting.AppHost'" /> + + + + <_AppHostVersion>%(_AppHostPackageReference.Version) + + + + <__CurrentAppHostVersionMessage> You are using version $(_AppHostVersion). + + + + + + + + + + - + \ No newline at end of file diff --git a/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.Aspire.targets b/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.Aspire.targets index 4cc3c75a84..1b7b21f6f5 100644 --- a/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.Aspire.targets +++ b/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.Aspire.targets @@ -1,9 +1,6 @@ + - - - - diff --git a/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.in.json b/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.in.json index 65b96d949f..6a5adf48cf 100644 --- a/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.in.json +++ b/src/Microsoft.NET.Sdk.Aspire/WorkloadManifest.in.json @@ -5,19 +5,7 @@ "description": ".NET Aspire SDK", "packs": [ "Aspire.Hosting.Sdk", - "Aspire.ProjectTemplates", - "Aspire.Hosting.Orchestration", - "Aspire.Hosting", - "Aspire.Dashboard.Sdk" - ], - // DCP only support these hosts - "platforms": [ - "win-x64", - "win-arm64", - "linux-x64", - "linux-arm64", - "osx-x64", - "osx-arm64" + "Aspire.ProjectTemplates" ] } }, @@ -29,36 +17,6 @@ "Aspire.ProjectTemplates": { "kind": "template", "version": "@VERSION@" - }, - "Aspire.Hosting.Orchestration": { - "kind": "sdk", - "version": "@VERSION@", - "alias-to": { - "win-x86": "Aspire.Hosting.Orchestration.win-x86", - "win-x64": "Aspire.Hosting.Orchestration.win-x64", - "win-arm64": "Aspire.Hosting.Orchestration.win-arm64", - "linux-x64": "Aspire.Hosting.Orchestration.linux-x64", - "linux-arm64": "Aspire.Hosting.Orchestration.linux-arm64", - "osx-x64": "Aspire.Hosting.Orchestration.osx-x64", - "osx-arm64": "Aspire.Hosting.Orchestration.osx-arm64" - } - }, - "Aspire.Hosting": { - "kind": "library", - "version": "@VERSION@" - }, - "Aspire.Dashboard.Sdk": { - "kind": "sdk", - "version": "@VERSION@", - "alias-to": { - "win-x86": "Aspire.Dashboard.Sdk.win-x86", - "win-x64": "Aspire.Dashboard.Sdk.win-x64", - "win-arm64": "Aspire.Dashboard.Sdk.win-arm64", - "linux-x64": "Aspire.Dashboard.Sdk.linux-x64", - "linux-arm64": "Aspire.Dashboard.Sdk.linux-arm64", - "osx-x64": "Aspire.Dashboard.Sdk.osx-x64", - "osx-arm64": "Aspire.Dashboard.Sdk.osx-arm64" - } } } } diff --git a/tests/Aspire.Hosting.Testing.Tests/Directory.Build.targets b/tests/Aspire.Hosting.Testing.Tests/Directory.Build.targets index a3f7fb3a47..bf347a727b 100644 --- a/tests/Aspire.Hosting.Testing.Tests/Directory.Build.targets +++ b/tests/Aspire.Hosting.Testing.Tests/Directory.Build.targets @@ -6,4 +6,9 @@ + + + $(MajorVersion).$(MinorVersion).$(PatchVersion) + + diff --git a/tests/Aspire.Hosting.Tests/MSBuildTests.cs b/tests/Aspire.Hosting.Tests/MSBuildTests.cs index e20373ff1e..0937dcfc3c 100644 --- a/tests/Aspire.Hosting.Tests/MSBuildTests.cs +++ b/tests/Aspire.Hosting.Tests/MSBuildTests.cs @@ -53,6 +53,13 @@ public class Class1 enable enable true + + + true + 8.2.0 diff --git a/tests/Aspire.Workload.Tests/TemplateTests.cs b/tests/Aspire.Workload.Tests/TemplateTests.cs index f48733a071..94f5f613fc 100644 --- a/tests/Aspire.Workload.Tests/TemplateTests.cs +++ b/tests/Aspire.Workload.Tests/TemplateTests.cs @@ -1,13 +1,14 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Text.RegularExpressions; using Xunit; using Xunit.Abstractions; namespace Aspire.Workload.Tests; // This class has tests that start projects on their own -public class TemplateTests : WorkloadTestsBase +public partial class TemplateTests : WorkloadTestsBase { public TemplateTests(ITestOutputHelper testOutput) : base(testOutput) @@ -58,6 +59,55 @@ public async Task BuildAndRunAspireTemplate(string config) } } + [Fact] + public async Task BuildAndRunAspireTemplateWithCentralPackageManagement() + { + string id = GetNewProjectId(prefix: "aspire_CPM"); + await using var project = await AspireProject.CreateNewTemplateProjectAsync(id, "aspire", _testOutput, buildEnvironment: BuildEnvironment.ForDefaultFramework); + + string version = ExtractAndRemoveVersionFromPackageReference(project); + + CreateCPMFile(project, version); + + await project.BuildAsync(); + await project.StartAppHostAsync(); + await project.StopAppHostAsync(); + + static string ExtractAndRemoveVersionFromPackageReference(AspireProject project) + { + var projectName = Directory.GetFiles(project.AppHostProjectDirectory, "*.csproj").FirstOrDefault(); + Assert.False(string.IsNullOrEmpty(projectName)); + + var projectContents = File.ReadAllText(projectName); + + var match = AppHostVersionRegex().Match(projectContents); + + File.WriteAllText( + projectName, + AppHostVersionRegex().Replace(projectContents, @"") + ); + + return match.Groups[1].Value; + } + + static void CreateCPMFile(AspireProject project, string version) + { + var cpmFilePath = Path.Combine(project.RootDir, "Directory.Packages.props"); + var cpmContent = $@" + + true + + NU1507;$(NoWarn) + + + + +"; + + File.WriteAllText(cpmFilePath, cpmContent); + } + } + [Theory] [InlineData("Debug")] [InlineData("Release")] @@ -107,4 +157,7 @@ public async Task ProjectWithNoHTTPSRequiresExplicitOverrideWithEnvironmentVaria await CheckDashboardHasResourcesAsync(page, []).ConfigureAwait(false); } } + + [GeneratedRegex(@"")] + private static partial Regex AppHostVersionRegex(); } diff --git a/tests/Shared/Aspire.Workload.Testing.targets b/tests/Shared/Aspire.Workload.Testing.targets index 04e8e1b6d3..6ad5018dc6 100644 --- a/tests/Shared/Aspire.Workload.Testing.targets +++ b/tests/Shared/Aspire.Workload.Testing.targets @@ -39,13 +39,13 @@ @@ -57,10 +57,10 @@ Explicitly invoke Build on these two projects so the GenerateTextReplacementFiles target gets triggered. This can be removed once the workloadtesting targets support a custom list of targets to invoke --> - - diff --git a/tests/Shared/RepoTesting/Aspire.RepoTesting.props b/tests/Shared/RepoTesting/Aspire.RepoTesting.props index e455b1b6bf..3cadbfa501 100644 --- a/tests/Shared/RepoTesting/Aspire.RepoTesting.props +++ b/tests/Shared/RepoTesting/Aspire.RepoTesting.props @@ -4,6 +4,14 @@ enable + + + true + + diff --git a/tests/Shared/RepoTesting/Aspire.RepoTesting.targets b/tests/Shared/RepoTesting/Aspire.RepoTesting.targets index 3b5fea5df7..14b270a859 100644 --- a/tests/Shared/RepoTesting/Aspire.RepoTesting.targets +++ b/tests/Shared/RepoTesting/Aspire.RepoTesting.targets @@ -143,4 +143,9 @@ + + + $(MajorVersion).$(MinorVersion).$(PatchVersion) + + diff --git a/tests/helix/send-to-helix-inner.proj b/tests/helix/send-to-helix-inner.proj index 99877c0234..ebcc638a18 100644 --- a/tests/helix/send-to-helix-inner.proj +++ b/tests/helix/send-to-helix-inner.proj @@ -160,9 +160,13 @@ + + + + - <_DcpInWorkloadPack Condition="'$(OS)' != 'Windows_NT'" Include="$(ArtifactsBinDir)dotnet-latest\packs\**\dcp" /> - <_DcpInWorkloadPack Condition="'$(OS)' == 'Windows_NT'" Include="$(ArtifactsBinDir)dotnet-latest\packs\**\dcp.exe" /> + <_DcpInWorkloadPack Condition="'$(OS)' != 'Windows_NT'" Include="$(DCPBinaryLocation)/dcp" /> + <_DcpInWorkloadPack Condition="'$(OS)' == 'Windows_NT'" Include="$(DCPBinaryLocation)\dcp.exe" />