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

Remove DCP and Dashboard from the .NET Aspire SDK Workload #4708

Merged
merged 25 commits into from
Aug 22, 2024

Conversation

joperezr
Copy link
Member

@joperezr joperezr commented Jun 27, 2024

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-codeflow for labeling automated codeflow. intentionally a different color! label Jun 27, 2024
@danegsta
Copy link
Member

danegsta commented Jun 27, 2024

We should test the DCP nuget packages on Mac/Linux to make sure there won't be any issues with the executable binaries; the SDK/workloads have a special mechanism for applying executable permissions (the UnixFilePermissions.xml file) and I'm not sure if simple nuget files support the same behavior. #Resolved

@joperezr
Copy link
Member Author

joperezr commented Jun 27, 2024

We should test the DCP nuget packages on Mac/Linux to make sure there won't be any issues with the executable binaries; the SDK/workloads have a special mechanism for applying executable permissions (the UnixFilePermissions.xml file) and I'm not sure if simple nuget files support the same behavior.

Good point. I did test this on Linux and Windows, and all scenarios I tested work as expected, but I didn't test on Mac yet. #Resolved

@danmoseley danmoseley removed the area-codeflow for labeling automated codeflow. intentionally a different color! label Jul 9, 2024
@joperezr joperezr marked this pull request as ready for review August 16, 2024 22:08
@joperezr

This comment was marked as outdated.

This comment was marked as outdated.

@joperezr
Copy link
Member Author

joperezr commented Aug 21, 2024

Ok folks, this is ready to go. Can I get a final review so this can get merged? cc: @DamianEdwards, @eerhardt, @radical, @danegsta #Resolved

docs/specs/future-of-workload.md Show resolved Hide resolved
eng/Build.props Outdated Show resolved Hide resolved
src/Aspire.Hosting.Sdk/SDK/Sdk.targets Show resolved Hide resolved
tests/Shared/Aspire.Workload.Testing.targets Outdated Show resolved Hide resolved
tests/Directory.Build.props Outdated Show resolved Hide resolved
src/Aspire.Hosting.Sdk/SDK/Sdk.targets Outdated Show resolved Hide resolved
src/Aspire.Hosting.Sdk/SDK/Sdk.targets Outdated Show resolved Hide resolved
@radical
Copy link
Member

radical commented Aug 21, 2024

Most of my feedback can be addressed in a follow up. #Resolved

This comment was marked as off-topic.

</PropertyGroup>

<!-- At this point, we should have the version either by CPM or PackageReference, so we fail if not. -->
<Error Condition="'$(AppHostVersion)' == '' or $([MSBuild]::VersionLessThan('$(AppHostVersion)', '8.2.0'))"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It might be useful to split this into two separate error messages, to help with debugging when this fails.

  1. AppHostVersion=='', we could not figure out the version to use, and have a better error message in case of CPM.
  2. AppHostVersion < 8.2.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would know at that point. If 1., then the warning will not have the version you are using (see line 90 above). If 2 then you'd see which version you are using in the error message.

Copy link
Member

@radical radical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work! LGTM! 👍

@joperezr joperezr enabled auto-merge (squash) August 22, 2024 18:31
@joperezr joperezr disabled auto-merge August 22, 2024 18:31
@joperezr joperezr enabled auto-merge (squash) August 22, 2024 18:31
@joperezr joperezr merged commit 4f5c1c3 into dotnet:main Aug 22, 2024
11 checks passed

.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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.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. This component cannot be changed into a regular NuGet package, as the logic it carries neeeds to be executed before the initial restore.

This bit makes it sound like the source generation comes from this SDK, but it doesn't. I would just drop it to avoid confusion.

- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.Dashboard.SDK (MSBuild SDK): Similar to the Orchestration SDK, this one provides the .NET Aspire Dashboard application (a framework-dependent 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.

This isn't a self-contained app.

- 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
- Aspire.Hosting.AppHost (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.

The Aspire.Hosting.AppHost is the nuget package that is referenced by all AppHost projects. It has a dependency on Aspire.Hosting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did actually mean Aspire.Hosting as that is the one that we had in the workload, but the wording is wrong here I agree, so I'll fix that.

eng/Build.props Outdated Show resolved Hide resolved
a reference to Aspire.Dashboard.Sdk and Aspire.Hosting.Orchestration for the build-time platform using
the same version. This is done here dynamically to avoid having to pull in DCP and Dashboard packages
for all of the platforms. This mechanism can be disabled by setting `SkipAddReferenceToDashboardAndDCP` to `true` -->
<Target Name="AddReferenceToDashboardAndDCP" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(SkipAddReferenceToDashboardAndDCP)' != 'true'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Target Name="AddReferenceToDashboardAndDCP" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(SkipAddReferenceToDashboardAndDCP)' != 'true'">
<Target Name="AddReferenceToDashboardAndDCP" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(SkipAddAspireDefaultReferences)' != 'true'">

Since this is more-or-less a public facing MSBuild property, I think we should leave names like "DCP" out of it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SkipImplicitAspireReferences?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or AspireSkipImplicitReferences

Playground applications have their own way of referencing Aspire.Hosting.AppHost, as well as DCP and Dashboard, so we disable
the Aspire.Hosting.SDK targets that will automatically add these references to projects.
-->
<SkipAddReferenceToDashboardAndDCP Condition="'$(TestsRunningOutsideOfRepo)' != 'true'">true</SkipAddReferenceToDashboardAndDCP>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radical - above we are using Condition="'$(RepoRoot)' != ''". Is one check better than the other? Should we be consistent?

<Target Name="__ErrorOnMininumWorkloadVersionMissing" BeforeTargets="PrepareForBuild"
Condition="'$(IsAspireHost)' == 'true' and ('$(AspireHostingSDKVersion)' == '' or $([MSBuild]::VersionLessThan('$(AspireHostingSDKVersion)', '8.2.0')))">
<Error Code="ASPIRE005"
Text="$(MSBuildProjectName) project requires a newer version of the .NET Aspire Workload to work correctly. Please run `dotnet workload update`." />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this message say what version is required?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this message say what version is required?

I'm not so sure about this one, but I am open to suggestions. The thinking is that this minimum version will change over time, so I'm not sure if we want consistent messages, especially when the fix is to run dotnet workload update which you can't really use to select which version to move to (as it always goes to latest).

Do we need a test for this?

I do think this would be good and I thought about it, but the problem is that it won't be trivial as I don't think we have a way of running tests with an SDK without the workload, or with an older workload, but @radical can correct me if I'm wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a test for this?

I do think this would be good and I thought about it, but the problem is that it won't be trivial as I don't think we have a way of running tests with an SDK without the workload, or with an older workload, but @radical can correct me if I'm wrong.

We do have a way to run tests with a SDK that has the updated manifest from artifacts, but does not have the workload installed. I can add that test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with an older workload
.. this would need some work. Do we want this one?

@@ -20,6 +20,10 @@
</ItemGroup>

<ItemGroup>
<!--
Note that this package won't add a transitive dependency to DCP and Dashboard, as those will dynamically be added by the SDK.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Note that this package won't add a transitive dependency to DCP and Dashboard, as those will dynamically be added by the SDK.
Note that this package won't add a transitive dependency to DCP and Dashboard, as those will dynamically be added by the Aspire.Hosting.Sdk.

@@ -143,4 +143,9 @@
<Import Project="$(RepoRoot)src\Aspire.Hosting.Sdk\SDK\Sdk.targets" Condition="Exists('$(RepoRoot)src\Aspire.Hosting.Sdk\SDK\Sdk.targets')" />
</ImportGroup>

<PropertyGroup Condition="'$(RepoRoot)' != 'null' and '$(TestsRunningOutsideOfRepo)' != 'true' and '$(IsAspireHost)' == 'true'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'$(RepoRoot)' != 'null'

is that the right condition?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the same condition than the one used by the itemgroup above (as I want it to apply exactly in the same situation). If we are changing one, we should change both.

@@ -0,0 +1,9 @@
<Project>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we creating all these RID specific packages for the Dashboard just so we can get RID specific app hosts? 99% of the nuget package is identical. The only difference is the executable that launches the app?

Could we make it more like a .NET global tool and only have to ship 1 nuget package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, I believe. We actually no longer need to have all of these separate projects anymore, so in a follow up PR I am going to explore how to reduce and simplify this.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove DCP and Dashboard from the .NET Aspire Workload
10 participants