Skip to content

Instantly share code, notes, and snippets.

@constructor-igor
Created October 24, 2016 21:40
Show Gist options
  • Save constructor-igor/3b2c1d2a64cd1efd9097a7791deb5224 to your computer and use it in GitHub Desktop.
Save constructor-igor/3b2c1d2a64cd1efd9097a7791deb5224 to your computer and use it in GitHub Desktop.
AssemblyDirectory
//
// http://stackoverflow.com/questions/52797/how-do-i-get-the-path-of-the-assembly-the-code-is-in
//
private static string AssemblyDirectory
{
get
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment