title: Problem with Team Build 2010 and web.config transformation
body: <p>I'm struggling to get web.config transformations working with automated builds.</p>
  
  <p>We have a reasonably large solution, containing one ASP.NET web application and eight class libraries. We have three developers working on the project and, up to now, each has "published" the solution to a local folder then used file copy to deploy to a test server. I'm trying to put an automated build/deploy solution in place using TFS 2010.</p>
  
  <p>I created a build definition and added a call to msdeploy.exe in the build process template, to get the application deployed to the test server. So far, so good!</p>
  
  <p>I then tried to implement web.config transforms and I just can't get them to work. If I build and publish locally on my PC, the "publish" folder has the correct, transformed web.config file.</p>
  
  <p>Using team build, the transformation just does not happen, and I just have the base web.config file.</p>
  
  <p>I tried adding a post-build step in the web application's project file, as others have suggested, similar to:</p>
  
  <pre><code>&lt;target name="AfterBuild"&gt;
  &lt;TransformXml Source="Web.generic.config"
               Transform="$(ProjectConfigTransformFileName)"
               Destination="Web.Config" /&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>but this fails beacuse the source web.config file has an "applicationSettings" section. I get the error</p>
  
  <p><strong>Could not find schema information for the element 'applicationSettings'.</strong></p>
  
  <p>I've seen suggstions around adding arguments to the MSBuild task in the build definition like</p>
  
  <pre><code>/t:TransformWebConfig /p:Configuration=Debug
  </code></pre>
  
  <p>But this falls over when the class library projects are built, presumably because they don't have a web.config file.</p>
  
  <p>Any ideas? Like others, I thought this would "just work", but apparently not. This is the last part I need to get working and it's driving me mad. I'm not an msbuild expert, so plain and simple please!</p>
  
  <p>Thanks in advance.</p>
  
  <p>Doug</p>