Visual Studio Solution Path environment variable
visual-studio-2008, visual-studio-2010
Solution
VS has a lot of Macro variables that work from within VS. The one that gives you the full path to the solution is called `$(SolutionDir)`. However, while this works from the Pre- and Post-build events (and, AFAIK, in the solution's MSBuild file), this is not an environment variable. If you think about, you can't have a (global) environment variable that points to "the path to the current solution", since you may have more than one instance of VS open.
Depending on your unit testing framework, you can often ask it about its execution context to get the current directory. That may not give you the solution path, though...
Problem
Does VS have an environment variable for the path to the current solution? For example, there is "%PathToWebRoot%" which is generally set to the "WebSites" directory in your VS project directory. The value of it can be changed in any number of ways. I'm wondering if there's a variable that changes each time you load a solution to point to it's root. I'm creating unit tests that will potentially be run on different machines and one of the directions you have to set before the method is the AspNetDevelopmentServerHost. It's recommended not to hard code them, of course, but the recommended environment variable isn't necessarily where your site will be and isn't in this case.