Chorn.Aspire.ExternalProject 2.0.0

dotnet add package Chorn.Aspire.ExternalProject --version 2.0.0
                    
NuGet\Install-Package Chorn.Aspire.ExternalProject -Version 2.0.0
                    
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="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Chorn.Aspire.ExternalProject" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Chorn.Aspire.ExternalProject" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Chorn.Aspire.ExternalProject --version 2.0.0
                    
#r "nuget: Chorn.Aspire.ExternalProject, 2.0.0"
                    
#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.
#:package Chorn.Aspire.ExternalProject@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Chorn.Aspire.ExternalProject&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Chorn.Aspire.ExternalProject&version=2.0.0
                    
Install as a Cake Tool

Aspire.ExternalProject

Aspire.ExternalProject is a .NET Aspire package for running a .NET project that is external to the current solution (e.g. in another repository) from your AppHost.

NuGet version (Chorn.Aspire.ExternalProject)

Since Aspire 17, Aspire itself can add a project by path with AddDotnetProject (package Aspire.Hosting.Dotnet). Version 2.0 of this package builds on it and adds what external projects still need:

  • No IDE launch. Under Visual Studio, Aspire hands .NET projects to the IDE to launch, and Visual Studio rejects projects that are not in its solution, so the resource fails to start. External projects are started by Aspire instead.
  • dotnet watch. Aspire 17 has no watch support for path-based projects.
  • A Debug dashboard command to attach a debugger to the running project.
  • Git support: a Git Pull dashboard command and an optional git up-to-date health check.

Usage

Install the package from NuGet:

dotnet add package Chorn.Aspire.ExternalProject

Add an external project via its project file in your AppHost. A relative path is resolved against the AppHost directory:

builder.AddExternalProject("resourcename", "../../OtherRepo/src/Api/Api.csproj");

This calls Aspire's AddDotnetProject, so the launch profile, Kestrel endpoints, OpenTelemetry, the dashboard launch URL and the coordinated build all work the way Aspire does them. It also adds two dashboard commands:

  • Debug - attaches a debugger to the external project.
  • Git Pull - pulls the latest changes from the git repository of the external project.

Building blocks

AddExternalProject is a shortcut. You can also start from Aspire's AddDotnetProject and add only what you need:

builder.AddDotnetProject("resourcename", "../../OtherRepo/src/Api/Api.csproj")
	.WithoutIdeLaunch()               // let Aspire start it, Visual Studio can't
	.WithDotnetWatch()                // recompile/hot reload on change
	.WithDebuggerAttachCommand(d => d.LaunchDebuggerUri = "/debug")
	.WithGitPullCommand()
	.WithGitUpToDateHealthCheck();

WithDebuggerAttachCommand, WithGitPullCommand and WithGitUpToDateHealthCheck work on any executable resource.

Options

Remove the git integration with SkipGitSupport:

builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
	options.SkipGitSupport = true;
});

Add a git up-to-date health check with EnableGitHealthCheck:

builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
	options.EnableGitHealthCheck = true;
});

By default the Debug command attaches through a running Visual Studio (Windows only), the same way Debug → Attach to Process does:

  1. a Visual Studio whose open solution contains the external project, so breakpoints in its source are hit (one that is not debugging yet is preferred),
  2. otherwise the Visual Studio that debugs the AppHost,
  3. otherwise LaunchDebuggerCommand (vsjitdebugger by default).

So the easiest way to debug an external project is to open its solution in a second Visual Studio and click Debug in the dashboard. Visual Studio instances running at a different elevation than the AppHost (e.g. "Run as administrator") can't be reached. Set DebuggerAttachMode = DebuggerAttachMode.Command to always use LaunchDebuggerCommand, e.g. for Rider.

As an alternative that works with any debugger, set LaunchDebuggerUri to an endpoint in your external project that starts the debugger via Debugger.Launch() (see the sample for the external project code):

builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
	options.LaunchDebuggerUri = "/debug";
});

The launch profile options are passed to Aspire: LaunchProfileName picks a profile, ExcludeLaunchProfile skips launchSettings.json entirely and ExcludeKestrelEndpoints ignores endpoints from Kestrel configuration.

builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
	options.ExcludeLaunchProfile = true;
}).WithHttpEndpoint();

Set UseWatch to start the external project with dotnet watch instead of dotnet run, so source changes are recompiled (hot reloaded, or a rebuild/restart for edits that can't be hot reloaded). It runs non-interactively, so a rude edit restarts the process automatically instead of prompting.

builder.AddExternalProject("resourcename", "path/to/external/project.csproj", options => {
	options.UseWatch = true;
});

Note: with UseWatch the process id changes when the app restarts, so the Debug command may need to be re-run after a restart. The URL-based debugger (LaunchDebuggerUri) tolerates restarts better.

Set LaunchFromIde to let the IDE launch the project like Aspire does for its own projects. Only do this if your IDE can launch the project (Visual Studio can't for projects outside its solution); UseWatch is then ignored under the IDE.

Migrating from 1.x

  • AddExternalProject now returns IResourceBuilder<DotnetProjectResource> instead of IResourceBuilder<ExecutableResource>.
  • A relative project path is resolved against the AppHost directory, not the current directory.
  • launchSettings.json is no longer required.
  • ExcludeKestrelEndpoints is now honored.
  • Your AppHost needs the Aspire.Hosting.Dotnet package (it comes with this package as a dependency).

Limitations and Known Issues

  • The Debug command can't find the app when it runs as dotnet App.dll (no apphost) under dotnet run or dotnet watch.
  • The vsjitdebugger fallback often fails with "No installed debugger has Just-In-Time debugging enabled", even when JIT debugging is enabled. The Visual Studio attach (the default) avoids it. If you are using Rider you can set the LaunchDebuggerCommand/Arguments to start Rider with the correct process and solution.
  • Turning off IDE launch and the dotnet watch launch rely on experimental Aspire APIs (ASPIREEXTENSION001), so this package is pinned to one Aspire major version.
  • With UseWatch, Aspire's coordinated build runs first and dotnet watch builds again.
  • Aspire builds external projects together before launching them, so SolutionGroup is rarely needed anymore. It can still help when projects rebuild themselves at launch (under an IDE, or with UseWatch).
  • Publishing goes through Aspire's .NET project publishing, which has not been tested with this package.

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

The project is added with Aspire's AddDotnetProject. WithoutIdeLaunch removes the resource's SupportsDebuggingAnnotation, so Aspire starts the process itself instead of sending it to the IDE. WithDotnetWatch replaces the launch command via WithLaunchToolArgs.

The Debug command finds the app process from the process id Aspire reports: without an IDE that is the app itself, under an IDE it is a dotnet run process with the app as its child, and under dotnet watch the app is further down. It then looks up the running Visual Studio instances in the Windows running object table (!VisualStudio.DTE.*), picks one as described above and calls its debugger's Attach() for that process. Only if none can attach does it start vsjitdebugger with the app's process id.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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
2.0.0 80 11/27/2026
1.9.0 259 11/25/2026
1.8.0 3,084 9/4/2026
1.7.0 1,311 7/7/2026
1.6.0 140 7/7/2026
1.5.0 15,665 11/13/2025
1.4.0 9,727 7/27/2025
1.3.0 5,817 3/29/2025
1.2.1 1,122 3/8/2025
1.2.0 216 2/28/2025
1.1.0 217 2/17/2025
1.0.0 227 2/16/2025
1.0.0-rc4 192 2/15/2025
1.0.0-rc3 223 2/15/2025
1.0.0-rc2 192 2/15/2025

v.2.0.0
- Breaking: rebuilt on Aspire's AddDotnetProject; AddExternalProject now returns IResourceBuilder<DotnetProjectResource>
- Breaking: relative project paths are resolved against the AppHost directory
- launchSettings.json is no longer required; ExcludeKestrelEndpoints is now honored
- External projects are started by Aspire instead of the IDE (Visual Studio can't launch them); opt in with LaunchFromIde
- New building blocks for AddDotnetProject: WithoutIdeLaunch, WithDotnetWatch, WithDebuggerAttachCommand, WithGitPullCommand, WithGitUpToDateHealthCheck, WithSolutionGroup
- Debug command finds the app whether it runs directly, under dotnet run or under dotnet watch
- Debug command attaches through the Visual Studio that has the project's solution open (falls back to the AppHost's Visual Studio, then vsjitdebugger); see DebuggerAttachMode
v.1.9.0
- Raised minimum Aspire to 17.0
v.1.8.0
- Added UseWatch option to run the external project with 'dotnet watch' (recompile/hot reload on change)
- Debug and Git Pull now work while an external project runs under watch
- Raised minimum Aspire to 13.5
v.1.7.0
- Show the launch profile's launchUrl in the dashboard
v.1.6.0
- Updated to target .NET 10
- Raised minimum Aspire to 13.4
- Honor ExcludeLaunchProfile to make launchSettings.json optional
- Show the 'Git Pull' output in the dashboard
v.1.5.0
- Updated to latest Aspire 13
v.1.4.0
- Updated to latest Aspire 9.3.1
v.1.3.0
- Added option to set the debugger launch command + arguments
v.1.2.1
- Fixed issue with launch profile not being set correctly
- Correctly adding the command line arguments to the external project on startup
v.1.2.0
- Updated to Aspire 9.1.0
- Added SolutionGroup property in the settings for startup-avoidance
v.1.1.0
- Improved pid retrieval and added option to launch a debugger from inside the external project
v.1.0.0
- First release