title: View folder not being copied by dotnet publish
body: <p>I have a .NET Core 2.0 multiproject solution. My main project is named myproject.Web and has a folder Views (with subfolder) where I have all the <code>cshtml</code> files. In addition, myproject.Web depends on another project, myproject.UI, which also has a folder Views which contains more <code>cshtml</code> that are common to many projects.</p>
  
  <p>The project myproject.Web runs fine when I execute <code>dotnet run</code> on the command line. However, when I <code>dotnet publish</code> and (in the publish folder) execute <code>dotnet myproject.Web.dll</code> the project does not work as expected. The landing page loads in the browser, but when I log in I received HTTP 404 error. After inspection I found that none of the files in the Views folder were being copied. That seems to be the likely source of the problem.</p>
  
  <p>I have managed to get the cshtml files in the UI project into the publish folder, but after all my efforts I cannot get the <code>cshtml</code>files in <code>myproject.Web\Views</code> into the publish folder. </p>
  
  <p>I post below the relevant parts of my <code>.csproj</code> file. </p>
  
  <pre><code>  &lt;ItemGroup&gt;
      &lt;Folder Include="Views\" /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;None Include="Views\**\*"&gt;
        &lt;CopyToOutputDirectory&gt;Always&lt;/CopyToOutputDirectory&gt;
        &lt;CopyToPublishDirectory&gt;Always&lt;/CopyToPublishDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
  
    &lt;Target Name="PostPublish" AfterTargets="AfterPublish"&gt;
      &lt;Exec Command="xcopy /E /Y /R  &amp;quot;$(ProjectDir)..\myproject.UI\Views\*&amp;quot; $(PublishDir)Views\*" /&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>The comment by Kirk below explains why the <code>cshtml</code> files are not being copied. But that does not explain why I get the 404 error. In brief:</p>
  
  <ol>
  <li>The 404 does not appear for the login page (it works as expected).</li>
  <li>The 404 error appears after performing logging.</li>
  <li>The <code>dotnet myproject.Web.dll</code> output does not show any error (copied below for completeness).</li>
  <li>This behaviour only happens with the published artifact, when executed with <code>dotnet run</code> it works perfectly.</li>
  </ol>
  
  <p><code>dotnet myproject.Web.dll</code> output:</p>
  
  <pre><code>Hosting environment: Local
  Content root path: C:\Projects\Master-Demos\Code\myproject.Web\bin\Release\netcoreapp2.0\publish
  Now listening on: http://0.0.0.0:57579
  Application started. Press Ctrl+C to shut down.
  ContentProvider [Watch]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  ContentProvider [GetFileInfo]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  ContentProvider [GetFileInfo]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  ContentProvider [Watch]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  ContentProvider [GetFileInfo]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  ContentProvider [GetFileInfo]: /Views/Home/../Shared/Widgets/_TileEnriched.cshtml
  </code></pre>