Sunday, February 24

Stupid .Net Tricks: Visual Studio and Subversion

This post isn't just another homage to my old friend's series of posts but also happens to involve him. How's that for irony? Or would it be serendipity? Whatever.

It just so happens that Craig has inherited an old project of mine and the first issue he ran into is one that I had to smash my face against about a year ago: Visual Studio hates Subversion.

Before Craig came to me, he went out and researched it on his own (Amen!) and discovered this thread, which pretty much sums it up. The .svn folders cause Visual Studio to barf.

The solution? As with most of the Windows projects I've worked on, a big fat ugly hack.

I have two working directories. One of them is a legitimate Subversion checkout, the other is just an export. What's the diff? Well, the former has the .svn files and the latter does not. So I point Visual Studio to the export version and use it for development, and when I need to commit my changes, I xcopy the export directory to the checkout directory. This copies just the modified files.

I do this so often I went ahead and threw it into a BATCH script:
@echo off
set SOURCE=C:\Inetpub\wwwroot\cyberdyne
set DESTINATION="C:\Documents and Settings\ted\Desktop\Cyberdyne\Subversion Working Copy"
xcopy %SOURCE% %DESTINATION% /d /e /v /r /y

Amusing anecdote: The order of the xcopy parameters "/d /e /v /r /y" is no coincidence, Devry is the name of the fine institution that Craig attended.