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.

3 comments:

Anonymous said...

Actually have a look on the interwebs for the _ (underscore) hack where you just make the svn directories start with _ instead and then everything works fine :)

cwalker77 said...

The *real* solution is to upgrade to something other than VS2003. 2K8 has almost decent refactoring and doesn't crash nearly as often -- and it doesn't have this bug. Unfortunately it doesn't downgrade all the way to .NET 1.1 so it's not in the running for this project.

Dave's tip sounds good though (thanks!).

Anonymous said...

You haven't had to hack Visual Studio for use with Subversion for like two years.