Wednesday, June 10, 2009

Hiding ASP.NET Configuration Files from VSS

All I wanted to do was to keep a few ASP.NET web site files from being versioned by Visual Sourcesafe.  Seemed like a reasonable request.  I'm talking about deployment specific configuration files with things like server names in them that are referenced in web.config using the configSource attribute.  This approach is necessary for real world scenarios, where, for instance, a production server would not know what to do with the name of a database which is located only on my dev box.  Unfortunately neither Visual Studio (current version 2008) nor VSS knows how to ignore any ASP.NET files.  

I wonder what does everyone else does? I've met few ASP.NET developers who actually know about the configSource attribute. And I suspect that the few that do probably struggle originally as I have with an occasional mishap and then turn to batch scripts like as I have done for many months now.

There must be a better way, I mumbled to myself this morning. So a-Googlin' I went. Through a quick search,  I've encountered several blog posts suggesting a hack on the vssscc file for the solution. Suppposedly you can add a line like "EXCLUDED_FILE0" = "filename" and reset the "NUMBER_OF_EXCLUDED_FILES" line. There's only one catch; it doesn't work.  There went 30 minutes down the drain.

After more extensive searching, I was able to find an awkward but workable solution, from a post on a slightly different topic, which is to set the machine specific files as "hidden" in Windows. Never used that feature of Windows before!  Never had a need to.

There you are. Easy, right.  Yeah, it's easy all right, once you know.  Hard if you don't know. I can't decide: Is it surprising that  productivity insights are about the hardest thing in software development to Google for, or is really not surprising at all?  After all, internet "knowledge" seems to be mostly the blind-leading-the-blind.

It took me months to buckle-down and hunt for a solution to this annoying problem. I'm really glad I finally got around to it. I certainly hope, however, that in the future my futility-o-meter becomes more sensitive and I don't wait as long when I run into productivity snags.