Vs2010 MvcBuildViews不触发 [英] Vs2010 MvcBuildViews Not firing

查看:69
本文介绍了Vs2010 MvcBuildViews不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Vs2008中的该项目针对.net 3.5,用于编译视图.

This project in Vs2008 targeting .net 3.5 used to compile views.

Vs2010 Targeting .net 4.0,以下查看代码未作为错误获得,而且我也没有找到要收听mvcBuildview跟踪/调试输出的信息:

Vs2010 Targeting .net 4.0 the following view code is not picked up as an error, and I have not found anyway to listen to the mvcBuildview trace/debug output:

<%{ %>

不会拾取完全不匹配的代码块声明,也不会从不存在的命名空间/类继承部分视图.

A completely unmatched code block declaration is not being picked up, neither was a partial view inheriting from a non existent namespace/class.

<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:

My BeforeBuild:

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

我的AfterBuild:

My 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 消息.编译成功,但是没有捕获视图编译错误.

I know the MvcBuildViews property is true because the Precompiling views message comes through. The compile is a success but it does not catch the view compilation errors.

我在这台机器上拥有Vs2010 Ultimate和2008 Developer + Database版本.

I have Vs2010 ultimate, vs 2008 developer+database edition on this machine.

因此,要么使用我尝试过的修复程序的组合来忽略这些错误,要么使用

So either it compiles ignoring the errors with some combinations of the fixes I've tried, or it errors with

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

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

The commented out sections are things I have tried Previously I have tried the fixes from these posts:

推荐答案

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

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

清理项目通常有助于避免此错误.

Cleaning the project often helps against this error.

这篇关于Vs2010 MvcBuildViews不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆