MVC View Compilation

To generate views’ code during compilation of ASP .NET MVC 2 application, its project file (*.csproj) should contain next (the rest has been omitted):

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="">
  <Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />

MvcBuildViews of the top most PropertyGroup should equal true and the AfterBuild target should invoke AspNetCompiler

This entry was posted in .NET, ASP .NET MVC, C#. Bookmark the permalink.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s