tags:

views:

847

answers:

2

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

c:\mybuilds\buildName\Daily_20090519.3\Release_PublishedWebsites\MyWebsite.

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.

A: 

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

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

  <Message Text="OutputDest : $(OutputDest)" />
  <Copy SourceFiles="@(_OutputFiles)"
        DestinationFiles="@(_OutputFiles->'$(OutputDest)%(RecursiveDir)%(Filename)%(Extension)')"/>
</Target>

Is this what you are looking for???

Sayed Ibrahim Hashimi
When you say 'edit the project' do you mean the website project, the web deployment project or the TFSBuild.proj?
simon831
I'm referring to the Web Deployment Project that you said you are using. They are MSBuild files themselves.
Sayed Ibrahim Hashimi
A: 

I'm using different technique.

<PropertyGroup>
    <BinariesRoot>c:\BinariesForIis\</BinariesRoot>
</PropertyGroup>

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

Tales Aguiar