我有一個夜間腳本,應該構建調試和發佈zip文件,然後通過ftp將這些文件上傳到客戶端。團隊構建 - 部署多個配置
我總是使用AfterDropBuild部署單一配置 - 工作正常 - 但在單個版本中構建兩個配置似乎都不起作用。我希望AfterDropBuild會執行兩次。我當然可以在AfterDropBuild中編寫任務來處理這兩個配置,但這並不正確。
有沒有更好的方法?
<Target Name="AfterDropBuild">
<CreateProperty Value="$(DropLocation)\ToClient">
<Output PropertyName="DeploymentFolder" TaskParameter="Value" />
</CreateProperty>
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)">
<Output TaskParameter="BuildNumber" PropertyName="BuildNumber"></Output>
</GetBuildProperties>
<CreateProperty Value="%(ConfigurationToBuild.FlavorToBuild)">
<Output PropertyName="ConfigFlavor" TaskParameter="Value" />
</CreateProperty>
<MakeDir Directories="$(DeploymentFolder)" />
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)" Name="ZipSite"
Message="Zipping Site">
<Output TaskParameter="Id" PropertyName="ZipStepID" />
</BuildStep>
<!-- get a list of all the files in the published web sites -->
<CreateItem Include="$(OutDir)_PublishedWebSites\Site.Web\**\*.*" >
<Output TaskParameter="Include" ItemName="FilesToZip"/>
</CreateItem>
<CreateItem Include="$(OutDir)\Site.msi" >
<Output TaskParameter="Include" ItemName="FilesToZip"/>
</CreateItem>
<!-- zip the deployment files -->
<Zip Files="@(FilesToZip)"
ZipFileName="$(DeploymentFolder)\Site_$(BuildNumber)_$(ConfigFlavor).zip"
WorkingDirectory="$(OutDir)_PublishedWebSites\Site.Web" />
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)" Id="$(ZipStepId)" Status="Succeeded" />
<!-- upload the zip -->
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)" Name="UploadZip"
Message="Uploading Zip to Client">
<Output TaskParameter="Id" PropertyName="ZipUploadID" />
</BuildStep>
<CreateItem Include="$(DeploymentFolder)\*.zip" >
<Output TaskParameter="Include" ItemName="FilesToUpload" />
</CreateItem>
<FtpUpload
RemoteUri="ftp://ftp.blahblah.com/"
LocalFiles="@(FilesToUpload)"
RemoteFiles="@(FilesToUpload->'%(RecursiveDir)%(Filename)%(Extension)')"
UserName="user"
Password="password"
/>
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)" Id="$(ZipUploadID)" Status="Succeeded" />
</Target>
感謝
謝謝,這幾乎是我所設想的。如果PackageBinaries或AfterDropBuild爲每個配置運行一次,它會更好。 – Jonesie 2010-01-18 17:30:11