Vs2010 MvcBuildViews Not firing
Posted
by Maslow
on Stack Overflow
See other posts from Stack Overflow
or by Maslow
Published on 2010-06-01T16:05:51Z
Indexed on
2010/06/05
22:32 UTC
Read the original article
Hit count: 627
asp.net-mvc
|visual-studio-2010
This project in Vs2008 targeting .net 3.5 used to compile views.
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>
My BeforeBuild:
<Target Name="BeforeBuild">
<WriteLinesToFile File="$(OutputPath)\env.config" Lines="$(Configuration)" Overwrite="true">
</WriteLinesToFile>
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)"-->
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.
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
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
The commented out sections are things I have tried Previously I have tried the fixes from these posts:
© Stack Overflow or respective owner