2010-06-01 77 views
1

此項目在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

註釋掉部分事情我已經試過 以前我曾嘗試錯誤從這些帖子修復:

+0

查看http://stackoverflow.com/questions/4725387/mvcbuildviews-not-working-correctly – kzfabi 2013-07-24 13:52:32

+0

@Maslow:你有沒有得到答案呢?我有同樣的問題,根本無法獲得任何解決方案。 – 2014-04-20 13:00:13

+0

@JoshuaFrank很確定我沒有 – Maslow 2014-04-20 15:49:19

回答

2

錯誤410它是使用註冊爲allowDefinition =應用程序級別之外 'MachineToApplication' 的節是錯誤的。此錯誤可能是由於虛擬目錄未被配置爲IIS中的應用程序。 web.config 100

清理項目通常有助於防止出現此錯誤。