代码之家  ›  专栏  ›  技术社区  ›  Maslow

Vs2010 MvcBuildViews未启动

  •  1
  • Maslow  · 技术社区  · 15 年前

    此项目在Vs2008中以.NET3.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>
    

    我的预构建:

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

    <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终极版,VS2008开发者+数据库版在这台机器上。

    因此,要么它编译时忽略错误和我尝试过的修复的某些组合,要么它编译错误

    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 回复  |  直到 4 年前
        1
  •  2
  •   user151323 user151323    15 年前

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

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