Reputation:
I'm looking for a way to return my assembly location at runtime, I can't use Assembly.Location because it returns the shadow-copied assembly's path when running under NUnit.
Upvotes: 0
Views: 83
Reputation:
Use CodeBase property instead, it return the original dll location rather than the shadow copied dll location.
For example:
Assembly assembly = GetType().Assembly;
Uri codeBaseUri = new Uri(assembly.CodeBase);
string path = codeBaseUri.LocalPath;
Upvotes: 3