Jeremy Fisher
Jeremy Fisher

Reputation: 2782

Visual Studio 2019 disable auto-building solution on save

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

Answers (4)

Luke Phillips
Luke Phillips

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

enter image description here

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

dodbrian
dodbrian

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.

enter image description here

Upvotes: 82

Emanuele
Emanuele

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:

  1. Right click on the project.
  2. Properties
  3. Code Analysis tab
  4. Uncheck "Run on build" and "Run on live analysis"
  5. Save. (probably it start the build for the last time)

That's all

Upvotes: 2

dxiv
dxiv

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.

enter image description here

To stop Intellisense from reporting errors in the Error List, choose the Build Only option in the dropdown circled in red.

Upvotes: 9

Related Questions