Chorn.Aspire.ExternalProject 1.0.0-rc3

This is a prerelease version of Chorn.Aspire.ExternalProject.
There is a newer version of this package available.
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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Chorn.Aspire.ExternalProject" Version="1.0.0-rc3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Chorn.Aspire.ExternalProject --version 1.0.0-rc3                
#r "nuget: Chorn.Aspire.ExternalProject, 1.0.0-rc3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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.

NuGet version (Chorn.Aspire.ExternalProject)

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 and ExcludeKestrelEndpoint 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 and ExcludeKestrelEndpoint 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 71 2/17/2025
1.0.0 65 2/16/2025
1.0.0-rc4 58 2/15/2025
1.0.0-rc3 63 2/15/2025
1.0.0-rc2 59 2/15/2025

v.1.0.0
- First release