Skip to content

Instantly share code, notes, and snippets.

@JsAndDotNet
Created June 28, 2023 10:15
Show Gist options
  • Save JsAndDotNet/578b278ff0a9d1c2d3fb16eea5d976ec to your computer and use it in GitHub Desktop.
Save JsAndDotNet/578b278ff0a9d1c2d3fb16eea5d976ec to your computer and use it in GitHub Desktop.
.NET Core - Files - Get Exec Assembly Location

.NET Core - Files - Get Exec Assembly Location

private string GetBasePath()
{
    var path = System.Diagnostics.Process.GetCurrentProcess()!.MainModule!.FileName;
    FileInfo fi = new FileInfo(path);

    // If you'd set something in a 'resources' folder and made the content copy always.
    var basePath = fi.Directory + @"\resources\";

    return basePath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment