Getting the Location of the executing Assembly on the .NET Compact Framework

12.04.2007 at 15:09

Had some time today to familirize myself with the .NET Compact Framework. Took me some time to find out how to get the location of the program on the device. Here is what i came up with afer some research.

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)

Marc

Comments (2)

A bit misleading

16.12.2009 by metator (metator.pt[at]gmail[dot]com)

Well, your tip pointed me to the right direction, but i think it's a bit misleading. When you say Location, you are meaning the directory where the assembly is located. To get the exact same value that is returned from the property Location in class Assembly, you should use Path.GetFullPath method instead.

developer

03.02.2010 by Ben Horgen (horben[at]yahoo[dot]com)

I'm pretty sure the Path.GetFullPath method is not included in the Compact Framework. Since the example is for doing it within the Compact Framework... you comment is probably mute.

1