title: how to rename for web deploy?
body: <p>I have a web application project:</p>
  
  <p><img src="https://i.stack.imgur.com/FjM47.png" alt="enter image description here"></p>
  
  <p>As you can see, there are 3 robots.txt files - one for each environment. There're also 3 publish profiles.</p>
  
  <p>Now, for each pubxml I want to pick the correct "robots.xxx.txt" file and rename it to "robots.txt". Ideally I would like to leverage MSBuild and keep the configuration within each pubxml file.</p>
  
  <p>Each of the 3 publish profiles is using <code>&lt;WebPublishMethod&gt;MSDeploy&lt;/WebPublishMethod&gt;</code>.</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Just tried <a href="https://stackoverflow.com/a/23219002/111438">Richard Szalay answer</a>, however to no avail. All 3 files are still copied to the output directory. This is what my publish profile looks like now</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &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;LaunchSiteAfterPublish&gt;True&lt;/LaunchSiteAfterPublish&gt;
          &lt;PrecompileBeforePublish&gt;True&lt;/PrecompileBeforePublish&gt;
          &lt;EnableUpdateable&gt;True&lt;/EnableUpdateable&gt;
          &lt;DebugSymbols&gt;False&lt;/DebugSymbols&gt;
          &lt;WDPMergeOption&gt;DonotMerge&lt;/WDPMergeOption&gt;
          &lt;ExcludeApp_Data&gt;True&lt;/ExcludeApp_Data&gt;
          &lt;publishUrl&gt;C:\Temp\myproject&lt;/publishUrl&gt;
          &lt;DeleteExistingFiles&gt;False&lt;/DeleteExistingFiles&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;ItemGroup&gt;
          &lt;MsDeployReplaceRules Include="robots"&gt;
              &lt;ObjectName&gt;filePath&lt;/ObjectName&gt;
              &lt;Match&gt;robots\.debug\.txt&lt;/Match&gt;
              &lt;Replace&gt;robots.txt&lt;/Replace&gt;
          &lt;/MsDeployReplaceRules&gt;
      &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>