此项目在Vs2008中以.net 3.5为目标编译视图。Vs2010 MvcBuildViews未触发
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
注释掉部分事情我已经试过 以前我曾尝试错误从这些帖子修复:
- Compile Views in Asp.net Mvc
- AllowDefinitionMachinetoApplicationError
- Turning on MVC Build Views in 2010 TFS
- Johnny Coder
查看http://stackoverflow.com/questions/4725387/mvcbuildviews-not-working-correctly – kzfabi 2013-07-24 13:52:32
@Maslow:你有没有得到答案呢?我有同样的问题,根本无法获得任何解决方案。 – 2014-04-20 13:00:13
@JoshuaFrank很确定我没有 – Maslow 2014-04-20 15:49:19