title: Transforming crossdomain.xml on publish in asp.net web application
body: <p>I'm attempting to transform crossdomain.xml for different environments, just like regular web.config files. I've tried using SlowCheetah add-in for visual studio, but it doesn't play well with web applications. It kept publishing transform files along with the <strong>transformed</strong> file, which i didn't want. Moreover, it did that for web.config transformation as well. </p>
  
  <p>My other thought was to rename the file and all transforms to crossdomain.$(Configuration).config in hopes that VS would pick it up and transform it and then rename it somewhere in the build process to crossdomain.xml. But VS wouldn't transform it at all. Here is what my transforms look like at the moment.</p>
  
  <p><strong>crossdomain.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain- policy.dtd"&gt;
  &lt;cross-domain-policy&gt;
     &lt;allow-access-from domain="*" secure="false" /&gt;
  &lt;/cross-domain-policy&gt;
  </code></pre>
  
  <p><strong>crossdomain.stage.config</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
  &lt;cross-domain-policy xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt;
     &lt;allow-access-from domain="*.foo.com" secure="true" xdt:Transform="Replace" /&gt;
  &lt;/cross-domain-policy&gt;
  </code></pre>
  
  <p>Does anybody have any suggestions?</p>
  
  <p><strong>UPDATE</strong>
  The more i spend time on this, the more i realize that deployments in .NET are a complete nightmare. Still trying to figure this out. Looks like VS publishing feature does some sort of half-assed deployment. It calls up MSBuild to gather files to deploy and then deploys it manually outside of MSBuild. So, there is no way to get the deployment path to do the transform. I'd have to stub it into MSBuild as a parameter. </p>