A target for MSBuild, which I use with BizTalk Deployment Framework (BTDF) for the BizTalk Server application deployment. But it is pretty generic and can be used whenever you need to copy a folder structure (files and sub-folders) into several places simultaneously.
Using the Code
This MSBuild target could be a part of the Deployment.btdfproj file (which is a file from the BTDF Deployment project). Also, you can add
it to the BizTalkDeploymentFramework.targets file of to any .target file.
Points of Interest
Here, I have to do a double loop in the Copy with two items,
NewBuildToCopy files and
Also, it generates a folder name in the [YYYYMMDD_hh_mm_ss] format.
<Target Name="AfterInstaller" AfterTargets="Installer">
<CurrentShare Include="$(Shares)%(EnvironmentName.Identity)$(SourceCodeShare)" />
<CurrentShare Include="$(PersonalShare)" />
Command='Rename "%(CurrentShare.Identity)\Current" "$(CurrentDateTime)"'/>
<Copy Condition="@(NewBuildToCopy) != ''"
That is a standard routine. I am developing a BizTalk Server application and use the BizTalk Deployment Framework (BTDF) for all my deployments. When an application is ready for testing, at the end, for production, the build files have to be deployed. Usually the BizTalk installation has several environments. For example, the environments can be: Development, QA, Staging, Production (here they are QA, STG, PROD). Sometimes less, sometimes more. The best practice is to keep all environments isolated of each other. So each environment keeps its deployment packages separately. That means, in my case, the build files should be copied to all environments.
A good practice is to save the old builds in case of rollback.
The folder structure for the builds looks like this:
The Current folder keeps the currently deployed build. The [YYYYMMDD_hh_mm_ss] folders keep the old builds.