Chorn.Aspire.ExternalProject
1.0.0-rc3
See the version list below for details.
dotnet add package Chorn.Aspire.ExternalProject --version 1.0.0-rc3
NuGet\Install-Package Chorn.Aspire.ExternalProject -Version 1.0.0-rc3
<PackageReference Include="Chorn.Aspire.ExternalProject" Version="1.0.0-rc3" />
paket add Chorn.Aspire.ExternalProject --version 1.0.0-rc3
#r "nuget: Chorn.Aspire.ExternalProject, 1.0.0-rc3"
// Install Chorn.Aspire.ExternalProject as a Cake Addin #addin nuget:?package=Chorn.Aspire.ExternalProject&version=1.0.0-rc3&prerelease // Install Chorn.Aspire.ExternalProject as a Cake Tool #tool nuget:?package=Chorn.Aspire.ExternalProject&version=1.0.0-rc3&prerelease
Aspire.ExternalProject
Aspire.ExternalProject is a .NET Aspire package to add a .NET project that is external to the current solution.
Usage
Install the package from NuGet:
dotnet add package Chorn.Aspire.ExternalProject
You can now add an external project via its csproj file in your app host:
builder.AddExternalProject("resourcename", "path/to/external/project.csproj");
This will add the project as an executable resource and wire up all the magic that the normal Aspire AddProject
method does.
In addition it will use 'dotnet run' to start the external project so automatic build and run should work as expected.
To debug the external project, you can use the Debug
command in the dashboard or just attach the debugger manually
from your IDE.
It will also add two commands to the dashboard:
- 'Debug' - Starts the debugger for the external project by starting the manual 'attach to VisualStudio' process.
- 'Git Pull" - Pulls the latest changes from the git repository of the external project.
as well as a health check to check if your branch is up to date with the remote.
You can remove the GIT integration or the health check by setting the WithoutGitSupport
and WithoutGitHealthCheck
properties to in the resource options.
builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
options.WithoutGitSupport = true;
options.WithoutGitHealthCheck = true;
});
Limitations and Known Issues
- Currently the
ExcludeLaunchProfile
andExcludeKestrelEndpoint
properties on the resource options are ignored. - Publish operations probably won't work as expected.
- Starting the debugger via the 'Debug' command in the dashboard might not attach correctly.
Motivation
Often it is not feasible to have a single solution for all projects, especially when working across multiple repositories. With this package you can temporarily add and remove external projects to your Aspire app host without having to add them to your solution while still being able to debug them.
Technical Details
We bascially replicate the work done in the AddProject
method, but with a few tweaks to make it work with external projects.
Starting the debugger is done by starting the vsjitdebugger
process with the pid of the external project.
Future Work
- Add support for the
ExcludeLaunchProfile
andExcludeKestrelEndpoint
properties. - Replicate the publish functionality if possible.
- Maybe switch to a custom resource type to make the external project more visible in the dashboard.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Aspire.Hosting.AppHost (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v.1.0.0
- First release