Get the local directory of an executing assembly

I used this code in C# to get the local directory of an executing assembly or application.

var uri = new Uri(Assembly.GetAssembly(typeof(MyClass)).CodeBase);
var path = Path.GetDirectoryName(uri.LocalPath);
var outputPath = Path.Combine(path, "MyFolder")
Get the local directory of an executing assembly Get the local directory of an executing assembly Reviewed by Edward Legaspi on Sunday, May 29, 2011 Rating: 5

No comments:

Powered by Blogger.