Skip to content

Instantly share code, notes, and snippets.

@andy-uq
Last active August 29, 2015 14:20
Show Gist options
  • Save andy-uq/5f04bb28464111bedcbb to your computer and use it in GitHub Desktop.
Save andy-uq/5f04bb28464111bedcbb to your computer and use it in GitHub Desktop.
Return the current solution directory, useful for tests
public static string GetBuildDirectory()
{
var solution = Environment.GetEnvironmentVariable("NCrunch.OriginalSolutionPath");
if (!string.IsNullOrEmpty(solution))
return Path.GetDirectoryName(solution);
var teamCityLocation = Environment.GetEnvironmentVariable("teamcity.build.checkoutDir");
if (!string.IsNullOrEmpty(teamCityLocation))
{
return teamCityLocation;
}
return Path.Combine(Environment.CurrentDirectory, "../../..");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment