views:

129

answers:

3

I have a CruiseControl.Net project set up to build an ASP.Net project, using an <svn> task to pull the latest code from source control.

On a successful build, I use a <buildpublisher> to copy the site to a deployment folder. My problem is that the buildpublisher is copying everything to the destination folder, including every .svn folder and its contents. What is the easiest way to strip out the .svn folders before copying to the deployment folder?

+1  A: 

You need to export from svn for deployment. Use the svn exe with arg=update instead of the usual arg=up setting

This will export your files to your deployment directory, removing the svn folders

Midhat
A: 

I use this lines for a web deployment project. Maybe you can adapt it for your purposes (MsBuild is a big miracle for me)

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\obj\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\.svn\**\*" />
</ItemGroup>
citronas
A: 

A simple solution (if it works for you): Add a step after the tasks block, before the publisher.

<exec>
  <executable>svn.exe</executable>
  <baseDirectory>c:\path_to_my_svn\</baseDirectory>
  <buildArgs>export MyWorkingCopyPath MyTemporaryPath </buildArgs>
</exec>

SVN will copy the working copy MyWorkingCopyPath (only items under version control) to the destination folder MyTemporaryPath.

And in the publisher, you must change the source as the MyTemporaryPath.

So, it is only 1 more task to add.

TridenT
Thanks. I used a modified version of this suggestion to get it working. I actually need to do the export prior to building, and set the build task to use the contents of MyTemporaryPath. Otherwise, if the export is done after the build, only the original source files are copied, and the Bin folder is left behind.I wish there was a way for the source control task to do the export automatically, but this works.
Mercury821