Skip to content

Instantly share code, notes, and snippets.

@jchadwick
Created June 19, 2012 19:55
Show Gist options
  • Save jchadwick/2956175 to your computer and use it in GitHub Desktop.
Save jchadwick/2956175 to your computer and use it in GitHub Desktop.
Get Project path for VS Test Runner
// Yeah, this is crazy, right? Stupid Visual Studio test runner...
var testPathReplacer = new System.Text.RegularExpressions.Regex(@"\\(?:(TestResults\\[^\\]*\\Out)|([^\\]*\\bin\\[^\\]*))");
var assemblyDirectory = Path.GetDirectoryName(GetType().Assembly.Location);
assemblyDirectory = testPathReplacer.Replace(assemblyDirectory, string.Empty);
assemblyDirectory = Path.Combine(assemblyDirectory, PROJECT_DIRECTORY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment