Subversion support in MSBuild Extension Pack available


I’m happy to announce that support for Subversion is now available in the MSBuild Extension Pack. This feature is owned by József Fejes who joined the project recently and has been developing the Subversion tasks. 26 check-ins later and in his own words:

Change Set 74081

Committed By:
fejesjoco

Comment:
Svn: implement Export, what I wanted is now finished, let the testing and feature requests begin

Right now this is only available in the 4.0.5.0 branch though we plan to move it into the 3.5.6.0 branch soon. The online help preview isn’t available for the upcoming releases yet but below is what József has for you to use in his initial contribution:

Svn Tasks

Valid TaskActions are:

Version (Required: Item Output: Info)

Info (Required: Item Output: Info)

GetProperty (Required: Item, PropertyName Output: PropertyValue

SetProperty (Required: Item, PropertyName, PropertyValue

Checkout (Required: Items, Destination)

Update (Required: Items)

Add (Required: Items)

Copy (Required: Items, Destination)

Delete (Required: Items)

Move (Required: Items, Destination)

Commit (Required: Items)

Export (Required: Item, Destination)

Namespace: MSBuild.ExtensionPack.Subversion
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

Remarks

The task needs a command-line SVN client (svn.exe and svnversion.exe) to be available. The following are supported and automatically detected:

  • any SVN client in the PATH environment variable
  • Cygwin 1.7, with the subversion package installed
  • TortoiseSVN 1.7, with the command line component installed
  • CollabNet Subversion Client 1.7
  • Slik SVN 1.7, with the Subversion client component installed
    If you publish a project that uses this task, remember to notify your users that they need one of the mentioned clients in order to build your code. The PATH detection allows everyone to set a preference, the other detections are there so that it will just work for most users.

The Version action calls svnversion.exe, all other actions call subcommands of svn.exe. Some parameters also accept URL’s, not just local paths. Please refer to SVN’s documentation for more information.

Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
<TPath Condition="Exists(‘$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks’)">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
</PropertyGroup>
<Import Project="$(TPath)"/>
<Target Name="Default">
<!– Version –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Version" Item="c:\path">
<Output TaskParameter="Info" ItemName="VInfo"/>
</MSBuild.ExtensionPack.Subversion.Svn>
<Message Text="MinRevision: %(VInfo.MinRevision), MaxRevision: %(VInfo.MaxRevision), IsMixed: %(VInfo.IsMixed), IsModified: %(VInfo.IsModified)"/>
<Message Text="IsSwitched: %(VInfo.IsSwitched), IsPartial: %(VInfo.IsPartial), IsClean: %(VInfo.IsClean)"/>
<!– Info –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Info" Item="c:\path">
<Output TaskParameter="Info" ItemName="IInfo"/>
</MSBuild.ExtensionPack.Subversion.Svn>
<Message Text="EntryKind: %(IInfo.EntryKind), EntryRevision: %(IInfo.EntryRevision), EntryURL: %(IInfo.EntryURL)"/>
<Message Text="RepositoryRoot: %(IInfo.RepositoryRoot), RepositoryUUID: %(IInfo.RepositoryUUID)"/>
<Message Text="WorkingCopySchedule: %(IInfo.WorkingCopySchedule), WorkingCopyDepth: %(IInfo.WorkingCopyDepth)"/>
<Message Text="CommitAuthor: %(IInfo.CommitAuthor), CommitRevision: %(IInfo.CommitRevision), CommitDate: %(IInfo.CommitDate)"/>
<!– GetProperty –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="GetProperty" Item="c:\path" PropertyName="svn:externals">
<Output TaskParameter="PropertyValue" PropertyName="GProp"/>
</MSBuild.ExtensionPack.Subversion.Svn>
<Message Text="PropertyValue: $(GProp)"/>
<!– SetProperty –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="SetProperty" Item="c:\path" PropertyName="test" PropertyValue="hello"/>
<!– Checkout –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Checkout" Items="http://repository/url" Destination="c:\path"/>
<!– Update –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Update" Items="c:\path1;c:\path2"/>
<!– Add –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Add" Items="c:\path\newfile"/>
<!– Copy –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Copy" Items="c:\path\file1;c:\path\file2" Destination="c:\path\directory"/>
<!– Delete –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Delete" Items="c:\path\something"/>
<!– Move –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Move" Items="c:\path\file1;c:\path\file2" Destination="c:\path\directory"/>
<!– Commit –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Commit" Items="c:\path\something"/>
<!– Export –>
<MSBuild.ExtensionPack.Subversion.Svn TaskAction="Export" Item="c:\path\workingcopy" Destination="c:\path\exported"/>
</Target>
</Project>

Please download the latest 4.0.5.0 code and let us know if the tasks meet your needs. As always, we appreciate any feedback via the Discussion and Issues boards on CodePlex.

Thanks József for this great contribution.

Mike

2 thoughts on “Subversion support in MSBuild Extension Pack available

  1. Pingback: MSBuild Extension Pack – April 2012 « Mike Fourie

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