我使用 Hudson 作为持续集成服务器和 Visual Studio 的 MSBuild 构建系统。
当我向 SVN 存储库提交新代码时,有时我会忘记添加刚刚添加到项目中的新视图 .cshtml
文件。
MSBuild 不会捕捉到这一点,也就是说,我最终会得到:
Build succeeded.
0 Warning(s)
0 Error(s)
问题:当我尝试访问该视图时,我只会看到我忘记在运行时将视图添加到项目中。
我已经按照 这里,但它并没有解决这个问题。
当视图不存在时,Visual Studio 会在 Action 方法中使用 font-color = Red 发出信号,并显示以下消息:无法解析视图 'ViewName':
代码仍然可以编译,没有错误。这很棒,但我的情况有所不同:视图就在那里,我只是忘记提交它。
希望有人知道如何克服这个...
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':
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...
发布评论
评论(1)
如果您在构建中自动执行打包或发布目标,您将在构建时收到任何缺少 .cshtml 文件的错误。
请参阅:http://vishaljoshi.blogspot.com/ 2009/02/web-packaging-creating-web-packages.html
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