After MSbuild has built my solution (with an website), and the webdeployment project has built and put the website in the directory _PublishedWebsites:


How do I copy this to the fixed directory where IIS points to for the test website?

I have found loads of code snippets, but I cannot seem to find one that will take into account the fact that this directory name changes.

Was it helpful?


This is pretty easy. You can edit the project and insert something similar to the following.

<Target Name="AfterBuild">
  <!-- Create an item with all the output files -->
    <_OutputFiles Include="$(OutputPath)**\*" Exclude="$(OutputPath)obj\**\*" />
  <!-- You probably don't want to include the files in the obj folder so exclude them. -->

  <Message Text="OutputDest : $(OutputDest)" />
  <Copy SourceFiles="@(_OutputFiles)"

Is this what you are looking for?

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build


I'm using different technique.


The c:\BinariesForIis\ will be used for direct output compiled binaries (before copy to ...\Daily_20090519.3\Release_ ...).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow