dotnet / dotnet/sdk

Make dotnet commands aware when the app is running with `dotnet watch`

Open
#53,092 3 comments 5 reactions 0 assignees View on GitHub
untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

When you start your app with `dotnet watch` operations like `dotnet build` and `dotnet test` are not able to fully complete because the binary files are locked. It would be great if the built in `dotnet` commands are aware of when the app is running in `dotnet watch` and when other commands like `dotnet build` are invoked it will communicate with `dotnet watch` to perform the action and return the info.

I'm mainly thinking of this to improve the copilot experience, but users can get into this situation outside of copilot as well. Below I have a video where I'm running a Razor Pages app with `dotnet watch` and then I ask copilot to make some changes and to ensure that the build succeeds. In this case it does the best that it can and then instructs the user to stop the app and manually run `dotnet build`. In other cases, I've seen copilot will identify the files are locked and then kill the process locking them in order for it to run `dotnet build`.

For many scenarios killing the app and restarting it takes a significant amount of time. This is especially true for MAUI apps. We considered authoring skills/instructions for copilot, but that would be limited to the users which add those assets to their project and it's not 100% for the files to be picked up and to follow the instructions correctly. Instead of trying to modify copilots behavior we feel that it would be better to update the commands so that copilot can perform the actions that it wants and get the info that it needs to continue.

https://github.com/user-attachments/assets/ee21b9fa-d96a-4a70-8a96-f2a013f278ba

@dbreshears @tmat @LittleLittleCloud @JakeRadMSFT @jonathanpeppers @davidortinau

cc @baronfel @timheuer

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.