【问题标题】:Vs2010 MvcBuildViews Not firingVs2010 MvcBuildViews没有触发
【发布时间】:2010-06-01 16:05:51
【问题描述】:

此项目在 Vs2008 中针对 .net 3.5 用于编译视图。

Vs2010 Targeting .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 开发者+数据库版。

所以要么编译时忽略错误,结合我尝试过的修复,要么出错

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

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

【问题讨论】:

  • @Maslow:你有没有得到这个答案?我遇到了同样的问题,根本无法解决。
  • @JoshuaFrank 很确定我没有
  • @马斯洛:叹息。这么简单又必要的功能,我怎么都搞不定!

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


【解决方案1】:

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

清理项目通常有助于防止出现此错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-16
    • 2017-08-15
    • 2020-02-06
    • 2013-05-31
    • 2013-03-13
    • 2021-06-27
    • 2015-11-25
    相关资源
    最近更新 更多