microsoft / microsoft/aspire

Ability to automatically open a web project on debug

Open
#4,608 2 comments 0 reactions 0 assignees View on GitHub
area-app-model
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Background and Motivation

It would help with debugging productivity if you could automatically launch web projects with Aspire when you start debugging in Visual Studio 2022 as you can if you're not using Aspire with startup/multiple-startup projects.

## Proposed API

```csharp
namespace Aspire.Hosting;

public static class ContainerResourceBuilderExtensions
{
public static IResourceBuilder OpenEndPointsOnDebug(this IResourceBuilder builder, string openEndPointsOnDebug []) where T: ContainerResource
}
```

## Usage Examples

```csharp
builder.AddProject("web")
.OpenEndPointsOnDebug(["https"])
```

Which would trigger the Aspire dashboard to open that endpoint in a new tab once it's started (only if debugger is attached).

## Alternative Designs

```csharp
builder.AddProject("web", openEndPointsOnDebug: ["https"])
```

## Risks

User might try to set a project to open to which the debugger doesn't automatically attach like a Blazor wasm project (would be good if VS2022 could though).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.