1

I'm using Hudson as Continuous Integration Server and Visual Studio's MSBuild build system.

When I commit new code to the SVN repository, sometimes I forget to add a new view .cshtml file just added to the project.

MSBuild won't catch this, that is, I end up with:

Build succeeded.
    0 Warning(s)
    0 Error(s)

Problem: I'll only see that I forgot to add the view to the project during runtime when I try to access that view.

I have already enabled <MvcBuildViews>true</MvcBuildViews> in .csproj file as described here, but it does not solve this problem.

When a View does not exist, Visual Studio signals that with font-color = Red inside an Action method with this message: Cannot resolve view 'ViewName':

enter image description here

The code still compiles with no errors. This is great, but my case is different: the View is there and I only forgot to commit it.

Hope someone knows how to overcome this...

Community
  • 1
  • 1
Leniel Maccaferri
  • 100,159
  • 46
  • 371
  • 480

1 Answers1

2

If you automate in your build the execution of the Package or Publish target you will get an error for any missing .cshtml files at build time.

See this: http://vishaljoshi.blogspot.com/2009/02/web-packaging-creating-web-packages.html

Brian Kretzler
  • 9,748
  • 1
  • 31
  • 28