microsoft / microsoft/aspire

Extend ContainerLifetime enum to destroy the containers on IDE close

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

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

The new Aspire 9 feature `ContainerLifetime.Persistant` is pretty cool to improve startup time.

The only issue I have is that the containers are still running after I close the solution in Visual Studio.

### Describe the solution you'd like

Create a third option to destroy the container on IDE close.

```
public enum ContainerLifetime
{
Session,
Persistent,
///
/// Attempt to re-use a previously created resource (based on the container name) if one exists. Destroy the container on IDE close.
///
///
Workspace,
}
```

I know this could be hard to implement because there are different IDEs to support but the process that creates the containers could possibly watch for it's parent process to be terminated to destroy the containers (Even that wouldn't be fail safe because I always can open another solution in VS or open another Directory in vscode.

But it would be a good start and it would be pretty useful to have the possibility as well.

### Additional context

_No response_

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.