title: Using msbuild to execute a File System Publish Profile
body: <p>I have a c# .Net 4.0 project created with VS2010 and now being accessed with VS2012.</p>
  
  <p>I'm trying to publish only the needed files from this website to a destination location <strong>(C:\builds\MyProject[Files])</strong></p>
  
  <p><strong>My file structure:</strong>
  ./ProjectRoot/MyProject.csproj
  ./ProjectRoot/Properties/PublishProfiles/FileSystemDebug.pubxml</p>
  
  <p><strong>I'm running the following via MSBuild:</strong></p>
  
  <p>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe ./ProjectRoot/MyProject.csproj /p:DeployOnBuild=true /p:PublishProfile=./ProjectRoot/Properties/PublishProfiles/FileSystemDebug.pubxml</p>
  
  <p><strong>Here's the xml in FileSystemDebug.pubxml</strong></p>
  
  <pre><code>&lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
    &lt;PropertyGroup&gt;
      &lt;WebPublishMethod&gt;FileSystem&lt;/WebPublishMethod&gt;
      &lt;LastUsedBuildConfiguration&gt;Release&lt;/LastUsedBuildConfiguration&gt;
      &lt;LastUsedPlatform&gt;Any CPU&lt;/LastUsedPlatform&gt;
      &lt;SiteUrlToLaunchAfterPublish /&gt;
      &lt;ExcludeApp_Data&gt;False&lt;/ExcludeApp_Data&gt;
      &lt;publishUrl&gt;C:\builds\MyProject\&lt;/publishUrl&gt;
      &lt;DeleteExistingFiles&gt;True&lt;/DeleteExistingFiles&gt;
    &lt;/PropertyGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>The resulting behavior is:</p>
  
  <ul>
  <li>a zip file is created here:<strong>./ProjectRoot/obj/Debug/Package/MyProject.zip</strong></li>
  <li>Nothing is deployed to <strong><code>&lt;publishUrl&gt;C:\builds\MyProject\&lt;/publishUrl&gt;</code></strong> WTF</li>
  <li>the zip file that is created is a pigs breakfast and full of files that aren't needed for the application.</li>
  </ul>
  
  <p>When I run this publish profile through visual studio a folder is created at *<em>C:\builds\MyProject*</em> and contains the exact artifacts that I want.</p>
  
  <p>How do I get this simple result from msbuild?</p>