title: How can I include view files from another project when compiling views?
body: <p>The project file already has the recommended way of doing this from <a href="https://stackoverflow.com/a/542944">this answer</a>.  However, that isn't enough for our case.  We happen to have shared views in another project.  Several files use shared .master pages that cause compilation errors when attempting to use aspnet_compiler.</p>
  
  <p>I tried accomplishing it this way:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"&gt;
    &lt;PropertyGroup&gt;
      &lt;TempFolder&gt;$(ProjectDir)\..\temp&lt;/TempFolder&gt;
    &lt;/PropertyGroup&gt;
    &lt;AspNetCompiler VirtualPath="temp" TargetPath="$(TempFolder)" PhysicalPath="other views location" /&gt;
    &lt;AspNetCompiler VirtualPath="temp" TargetPath="$(TempFolder)" PhysicalPath="$(ProjectDir)" /&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>It turns out aspnet_compiler requires the <code>TargetPath</code> folder to be empty, so this is a no go.  Trying it with just the <code>VirtualPath</code> and no <code>TargetPath</code> doesn't work because the <code>VirtualPath</code> is temporary and doesn't carry over to the second compiler call.</p>
  
  <p>Is there any way of accomplishing this?  We could obviously copy over the master pages to this project, but that isn't exactly a good solution.</p>