Vs2010 MvcBuildViews没有开火

时间:2010-06-01 16:05:51

标签: asp.net-mvc visual-studio-2010

此项目在Vs2008中以.net 3.5为目标,用于编译视图。

Vs2010定位.net 4.0下面的视图代码没有被选为错误,我还是没有找到听mvcBuildview跟踪/调试输出:

<%{ %>

没有获取完全无法匹配的代码块声明,也不是从不存在的命名空间/类继承的部分视图。

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWithBuildViews|AnyCPU' ">

<!--<BaseIntermediateOutputPath>bin/intermediate</BaseIntermediateOutputPath>-->
<!--<MvcBuildViews Condition=" '$(Configuration)' == 'DebugWithBuildViews' ">true</MvcBuildViews>-->
<EnableUpdateable>false</EnableUpdateable>
<MvcBuildViews>true</MvcBuildViews>
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
 </PropertyGroup>

我的BeforeBuild:

<Target Name="BeforeBuild">
<WriteLinesToFile File="$(OutputPath)\env.config" Lines="$(Configuration)" Overwrite="true">
</WriteLinesToFile>

我的AfterBuild:

<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<!--<BaseIntermediateOutputPath>[SomeKnownLocationIHaveAccessTo]</BaseIntermediateOutputPath>-->
<Message Importance="high" Text="Precompiling views" />
  <!--<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)..\$(ProjectName)" />-->
<!--<AspNetCompiler VirtualPath="temp" />-->
<!--PhysicalPath="$(ProjectDir)\..\$(ProjectName)"-->

我知道MvcBuildViews属性为true,因为Precompiling views消息是通过的。编译是成功的,但它不会捕获视图编译错误。

我拥有Vs2010终极版,与此机器上的2008开发人员+数据库版本相比。

所以要么它编译忽略了我尝试过的修复程序的某些组合的错误,要么错误

Error 410 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. web.config 100

注释掉的部分是我尝试过的 以前我尝试过这些帖子中的修复:

1 个答案:

答案 0 :(得分:2)

  

错误410使用在应用程序级别之外注册为allowDefinition ='MachineToApplication'的部分是错误的。此错误可能是由于未在IIS中将虚拟目录配置为应用程序引起的。 web.config 100

清理项目通常有助于解决此错误。