Thursday, September 21, 2006

Getting Application Path in Compact Framework

Application.StartupPath is not supported under CF. Usually you would use System.Relection to get the Application Path using:

string appPath = System.Relection.GetExecutingAssembly().Location;

But again this isn't supported under CF so you have to:

string appPath = Assembly.GetExecutingAssembly().GetName().CodeBase;
appPath = System.IO.Directory.GetDirectoryName(appPath);


Easy eh?

5 comments:

Anonymous said...

Path.GetDirectoryName instead of Directory.GetDirectoryName

Anonymous said...

Happens even more cheerfully :)

Anonymous said...

Can anyone recommend the best RMM utility for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central event management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Anonymous said...

You were not mistaken

Anonymous said...

It agree, this remarkable opinion


I can look for the reference to a site with the information on a theme interesting you. Hot Health