Thursday, July 29, 2010

Visual Studio tests and punctuation in project paths

A modern file system is a friendly thing. We can use all manner of characters, such as punctuation, in the file and folder names. This makes the path easier to read an provides a nicer experience for those of us that appreciate good grammar on our desktops.

I, for example, often name folders for myself or for clients so a folder named "Bob's stuff" or "Dave's projects" would not be uncommon.

If however you associate unit test suites with these projects an exception will be thrown by the test execution system complaining about illegal characters in the path.

To avoid this, and because I did not want to be forced to rename directories that had other relationships in then, I discovered that the use of the good old DOS subst command could provide a drive letter for the offending folder and allow tests to run.

It should be noted that this problem no longer exists in Visual Studio 2010 but for anyone still running on 2008 this little trick can be a life saver.



No comments: