这个项目在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属性是真的,因为Precompiling views消息是通过的。编译是成功的,但它没有捕获视图编译错误。
我有Vs2010终极,vs 2008 developer+database版在这台机器上。
因此,它要么使用我尝试过的一些修复组合来编译忽略错误,要么使用它进行错误编译。
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
注释掉的部分是我以前尝试过的--我尝试过从这些帖子中修复:
发布于 2010-06-01 16:08:38
错误410 --在应用程序级别之外使用一个注册为allowDefinition='MachineToApplication‘的部分是一个错误。此错误可能是由于未将虚拟目录配置为IIS中的应用程序造成的。web.config 100
清理项目通常有助于防止此错误。
https://stackoverflow.com/questions/2951358
复制相似问题