简体   繁体   中英

How to prevent Visual Studio from starting debug session in case of errors

When I press F5 , Visual Studio builds my project and runs it (under debugger). It does so even if there are typescript of razor/cshtml errors in the errors window.

I would like Visual Studio to skip the run just like it does in case of C# compiler errors.

  • Visual Studio 2019 Pro
  • ASP.NET MVC project (not .NET Core)

Edit the .Web.csproj project file with an editor and add the following to the <PropertyGroup> tag:

<MvcBuildViews>true</MvcBuildViews>

The end result should look like this:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    ...
    <MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>

You will need to reload the project\\visual studio. This will compile the views now. Remember compilation of the View files will increase your overall compilation time for the project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM