Reputation: 2782
I am using Visual Studio 2019 enterprise to work on a .NET project. I wasn't noticing it before, but it seems like every time I am saving a file, the solution is building. I am inferring this because when I save, I can see a number with a red X next to it in the bottom pane. And if i click on the bottom pane, it will open up a console showing me build errors. This changes every time I save.
This is an annoying "feature". I searched for multiple solutions, but none of them work. The "code analysis" option for a solution is deprecated, so you can't change it. I don't have any abnormal extensions either, so this looks like a VS feature.
Upvotes: 42
Views: 21090
Reputation: 3832
In Visual Studio 2022, with the Hot Reload feature, there is an option that allows applying the code and restarting the application on save
More information about Hot Reload can be found here: https://devblogs.microsoft.com/dotnet/update-on-net-hot-reload-progress-and-visual-studio-2022-highlights/
Enabling/Disabling it will change whether the application re-builds
Upvotes: 2
Reputation: 1564
Another one but very similar cause of the automatic rebuild and restart is Auto build and refresh browser after saving changes
option under the Tools -> Options -> Projects and Solutions -> ASP .NET Core
settings.
Just set it to None
or any other option than Auto build and refresh browser after saving changes
.
Upvotes: 82
Reputation: 21
I have the same issue and annoying behavior with Visual Studio 2019.
Every time I am saving a file, the solution is building.
If you have a big solution and project, this is a great loss of time.
If you forget a simple semicolon, correct, ctrl+s to save and boom: automatically Visual Studio start the Build
The solution: disable code analysis for .NET.
Follow this link:
https://learn.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019
The steps:
That's all
Upvotes: 2
Reputation: 17668
when I save, I can see a number with a red X next to it in the bottom pane. And if i click on the bottom pane, it will open up a console showing me build errors.
As clarified in the comments, what opens is the Error List, which by default displays both build and IntelliSense errors. There is no automatic build taking place when saving files, but IntelliSense does auto-update while editing, and displays the errors it finds in the Error List.
To stop Intellisense from reporting errors in the Error List, choose the Build Only option in the dropdown circled in red.
Upvotes: 9