MSBuild Task for deploying a WebSite

In the MSBuild Tasks there is a Task for Copy-ing a File or a Collection of Files ( ItemGroup ). But as it turns out the Exclude filtering of the ItemGroup is too limited to have a good deployment of a WebSite/WebApplication.

The guys of Microsoft UK have made a distribution available of the Microsoft.Sdc.Tasks ( see GotDotNet ) but their Folder.Copy lacks any Exclude filtering.

That’s why I created our own CopyFolder. The Exclude filter can be used in 2 ways:

  • .extention -> any file with that extention will be excluded from the copy
  • SomeString -> any file where the filename (with relative path) contains SomeString will be excluded

Binaries:

TamTam.Deployment.Tasks.zip (4,63 KB)

MSBuild project file:

<

Project DefaultTargets="Full" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="TamTam.Deployment.Tasks" />

<PropertyGroup>

<SourcesForWebSite>C:\BuildLab\build\www\</SourcesForWebSite>

<WebExcludes>.cs;.txt;.scc;csproj;.resx;.resources;.cache;.pdb;App_;\obj</WebExcludes>

<DestForWebSite>\\server\folder</DestForWebSite>

</PropertyGroup>

<Target Name="Full" DependsOnTargets="

WebSite"

/>

<Target Name="WebSite">

<Message Text="Deploying WebSite" />

<CopyFolder
Source="$(SourcesForWebSite)"
Destination="$(DestForWebSite)"
SkipUnchangedFiles="true"
Exclude="$(WebExcludes)" />

</Target>

</

Project>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: