MVCBuildViews不能正常工作 [英] MVCBuildViews not working correctly

查看:549
本文介绍了MVCBuildViews不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我编辑上的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中应用程序的虚拟目录引起的。

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in 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.

编辑:见<一href=\"http://stackoverflow.com/questions/4725387/mvcbuildviews-not-working-correctly/4732019#4732019\">Joe Cartano的回答一个更持久的解决方案。

See Joe Cartano's answer for a more permanent solution.

这篇关于MVCBuildViews不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆