harriyott.com

Saturday, July 08, 2006

SourceSafe can't leave well alone

So the RTM version of SourceSafe has a irritating "feature". When getting the latest version of a directory, if you have a writeable version of a file, SourceSafe offers two options: overwrite it with the checked in version, or check out the file.

Before screen shot

I want to do neither. I would like to just leave it as it is, and move on. The dialog has even has the option there to leave it, but it is tantalisingly disabled. If only I could enable it. If only..

Well, it turns out that I could. I had to write a little app to do it, but it does it. This app has a single button: "Enable Leave Button". It locates the radio button on the dialog, and enables it. I can then click the radio button, and click and OK, and it does actually leave the file alone. It doesn't overwrite the file; it doesn't check it out.

So here's what the dialog looks like after clicking the "Enable Leave Button" button:

Before screen shot

Fantastic. I love being a geek. I've made this little app available for you to download from here, if you have this problem too. I've got some plans for it, but it works at the moment. You'll need the .NET framework version 2.0, which I assume you'll have, as you probably installed it with the offending version of SourceSafe.

[Update: I've posted the source code.]

[Tags: ]

15 Comments:

piers7 said...

so blindingly obvious in retrospect! clever sod.

July 08, 2006 11:18 AM  
Simon said...

Well, I suppose it is! I happened to see a seminar recently where Dinis Cruz, a security expert did just that with a different application, so I can't take credit for the idea. His point was that the code should be secured as well as the GUI.

July 08, 2006 11:27 AM  
Anonymous said...

i sufered sourceSafe during three years. In last year i've been using Subversion and my life become much better.

Leave .Net and begin with Java, was good idea too.
enguillem

July 11, 2006 9:11 PM  
Simon said...

I've heard good things about subversion, but I'm halfway through a big project at the moment, so I can't chance. Same goes for .NET.

July 12, 2006 7:37 AM  
Stewart said...

Cool idea Simon, I didn't even know you could do that!
I don't suppose you would post the code for this, I'd love to have a look.

July 14, 2006 10:36 AM  
Simon said...

Stewart, I've posted the source code here. Enjoy!

July 20, 2006 12:18 PM  
Jacob said...

Subversion blah, blah, blah. I'm a personal fan of SourceGear Vault. It's a complete Source Safe replacement. It upgrades existing SS databases. It uses SQL Server to store the files (can you say automated backup and getting off the file system?). It's very fast over a network. It can handle both source control styles (edit|merge as well as Check out|edit|check in). And best of all (for my personal development), it is free for a single-user license out of the box. I've been off Source Safe for years and never looked back.

July 21, 2006 5:42 PM  
Simon said...

Jacob, I've been using Vault at home, and I agree with you - it's great. Unfortunately I don't have the luxury of choice at work. Hence the hack...

July 21, 2006 6:07 PM  
Jacob said...

I hear ya. I've been fortunate in the last couple of years that I've been able to convince management to "upgrade". Usually before VSS ate anything... :)

July 21, 2006 11:03 PM  
Anonymous said...

This saved my butt.
WTF they were thinking!?

August 18, 2006 6:09 AM  
Bob said...

This is excellent, thank you. Worked great on my hijacked global.asax file (which must stay different than the checked-in one).

However, the dialog for the web.config file is different - and none of the 4 options are to leave it alone! If you have an idea, let me know.

Thanks,
Bob

September 07, 2006 12:40 AM  
Mijjil said...

Definitely a lifesaver of an app, dude, thanks. Can you post the rest of the code? I am having trouble getting it to compile in Visual Studio 2005...

{M}

November 17, 2006 1:26 PM  
Mijjil said...

Nevermind, found it, the magic I needed was:

using System.Runtime.InteropServices;

{M}

November 17, 2006 1:43 PM  
Jon said...

Simon, thanks for posting this! I gave it a try, and it worked great.

I did a bit of further poking around online, and found a microsoft.public.vstudio.sourcesafe post by Alin Constantin [MSFT], providing a riskier but perhaps more "stand-alone" workaround of manually modifying the VSS file ssgui.dll (with a hex editor) to cause the "Leave this file" radio button to always be enabled.

I decided to go ahead and give it a try, and it seems to be working for me so far, though I'll certainly be keeping a closer eye on my checkouts and checkouts while using VSS with that modified binary!

Alin's post can be found here:

http://groups.google.com/group/microsoft.public.vstudio.sourcesafe/msg/db3c4721b8dd4e6f

December 19, 2006 8:41 PM  
Simon said...

Cool, thanks Jon. As you say, quite risky - if I try it, I'll take a backup first!

December 19, 2006 8:46 PM  

Post a Comment

Links to this post:

Create a Link

<< Home