2009-05-21 14 views
2

MSBuildのは(asp.netのウェブサイトとの)私の解決策を構築していて、webdeploymentプロジェクトが構築されており、ディレクトリ_PublishedWebsitesにウェブサイトを入れた後:のMSBuildと_PublishedWebsites

C:\ mybuilds \ buildName \ Daily_20090519.3 \ Release_PublishedWebsites \ MyWebsite。

IISをテスト用Webサイトの指す固定ディレクトリにコピーするにはどうすればよいですか?

コードスニペットが大量に見つかりましたが、このディレクトリ名が変更されたことを考慮する必要があります。

答えて

1

これはかなり簡単です。プロジェクトを編集して、次のようなものを挿入することができます。

<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> 

これはあなたが探しているものですか?

サイード・イブラヒムHashimi

のMy Book:私は別の技術を使用していInside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

+0

「プロジェクトを編集する」と言ったら、ウェブサイトプロジェクト、Webデプロイメントプロジェクト、TFSBuild.projを意味しますか? – simon831

+0

私はあなたが使用しているWeb Deployment Projectを参照しています。 MSBuildファイル自体です。 –

1

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

c:\BinariesForIis\は(...\Daily_20090519.3\Release_にコピーする前に...)ダイレクト出力コンパイルされたバイナリに使用されます。