views:

410

answers:

4

How do I get the path of the current assembly? I need to get data from some paths relative to the location of hte current assembly (.dll).

I thought someone told me to use the reflection namespace but I can't find anything in there.

Thanks, Scott

+4  A: 

You can use:

string path = (new System.Uri(Assembly.GetExecutingAssembly.CodeBase)).AbsolutePath;
Reed Copsey
+3  A: 
Assembly.GetExecutingAssembly().Location
RichieHindle
+5  A: 

Assembly.GetExecutingAssembly().Location

Daniel Brückner
+1 for the documentation links. 8-)
RichieHindle
+2  A: 

Just to make it clear:

Assembly.GetExecutingAssembly().Location
Boo
+1: Doubt Is Bad.
RichieHindle