问题描述
所以我编辑上的MVC 3 RTM应用程序设置以下属性我的csproj文件:
So I edited my csproj file on an MVC 3 RTM application to set the following property:
<MvcBuildViews>true</MvcBuildViews>
这应该引起构建过程中要遵守我的意见,并强制生成错误,如果我的看法是坏了。这就是我所做的唯一的变化,但是,当我尝试构建应用程序,我得到以下错误:
This should cause my views to be complied during build and force a build error if my view is broken. This is the only change I made, however, when I try to build the application, I get the following error:
这是使用注册为allowDefinition =应用程序级别之外'MachineToApplication'的节是错误的。这个错误可以通过未被配置为在IIS中应用程序的虚拟目录引起的。
该项目编译,如果我变回假成功运行,
The project compiles and runs successfully if I change back to false,
以下是在的csproj文件中配置的构建任务(这些从来没有手动编辑,他们被Visual Studio 2010中添加)
The following are the build tasks configured in the csproj file (these were never manually edited, they were added by Visual Studio 2010)
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target> -->
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
我失去了一些东西在这里?我如何得到正确的配置在编译的时候来验证我的观点MVC 3 / Visual Studio 2010的?
Am I missing something here? How do I get MVC 3 / Visual Studio 2010 configured correctly to validate my views at build time?
推荐答案
我前几天有这个问题,我删除OBJ / Debug文件夹固定它。
I had this problem a few days ago and I fixed it by deleting obj/Debug folder.
编辑:见Joe Cartano的回答一个更持久的解决方案。
See Joe Cartano's answer for a more permanent solution.
这篇关于MVCBuildViews不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!