views:

308

answers:

3

I'm using ASP.NET Web Deployment Projects with TortoiseSVN and VisualSVN, but this is a general question about generated files in Subversion.

A Web Deployment Project automatically generates a parallel "deployment" version of your website with all code stripped out and compiled into a single assembly. My file structure is:

  • Trunk
  • Trunk/MyProject (website root)
  • Trunk/MyProject_deploy (deployment project root)
  • Trunk/MyProject_deploy/Release (deployment website root, automatically generated)

Here's the problem: MyProject_deploy/Release is regenerated on build (in Release mode). The directory is deleted and re-created, so I lose all the .svn metadata; and when I go to commit, I get status "Obstructed", which I've looked up and means that there's an unmanaged local folder with the same name as a managed folder on the server.

(I could just ignore the Release folder, but I want to do FTP deploy directly from the Subversion server.)

What's the best way to deal with auto-generated files in Subversion?

+1  A: 

If you're using Visual Studio, could you define pre and post-build events to move the .svn directory (or directories) out of Release before your build, and then back in afterward?

MattK
+11  A: 

Set the svn:ignore property. Don't add them to your version control system. Anything generated by the build process doesn't belong there. What does belong there are the things needed to complete the build process.

I'd recommend adding a continuous integragion server like CruiseControl.NET to the mix - it can build the project from the source, and then do the deploy from that. This will put you in the position of using 2 best practices instead of 1, and still solve your problem.

Harper Shelby
A: 

This is also a problem when using Setup projects to create Windows Installer output.

One option is to change the Output file name so that the generated files are dumped in your deployment project root, rather than in a sub-folder called "Release".

In the case of the Setup project, I was generating a single MSI file and this worked well - no folders are being deleted/re-created so no SVN errors, and it is clean with only two files in the deployment project root folder.

Lessan Vaezi