Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC: how to signal compilation error if a view has error?

My view has errors. I see these errors only if I open the view in Visual Studio.

I would like to see the errors on compile time rather than on execute time.

Does exist a way to obtain this behavior?

like image 351
Ricibald Avatar asked May 28 '09 12:05

Ricibald


1 Answers

You can update by hand the .csproj file and add a <MvcBuildViews>true</MvcBuildViews> that will compile the views as you go.

Here's a link I googled, you'll find others as well.

EDIT: If it's too slow try setting the build only for Release, edit the csproj file doing something like this; see the docs for AspNetCompiler for more details.

<!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   Other similar extension points exist, see Microsoft.Common.targets.
   -->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
    <AspNetCompiler VirtualPath="Temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
like image 174
Scott Avatar answered Oct 03 '22 13:10

Scott