Compiling MVC Views

As part of the build process on the apps team at Esendex, we like to be doubly sure nothing is broken by not only compiling, running unit tests, acceptance tests, integration tests AND regression tests, but also checking that all our views compile too.

There’s loads of blog posts on how to do this, quite simply open your MVC csproj file in notepad, and in your the <ProjectGroup> node for the specific configuration you want to compile the builds add:
<MvcBuildViews>true</MvcBuildViews>

For example:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug with compiled views|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<MvcBuildViews>true</MvcBuildViews>
</PropertyGroup>

What did you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s