Compact Framework Current Folder
Windows Mobile doesn't have the concept of a current folder. The "current folder" is basically always set to be the root of the filesystem, no matter where your application is located.
To get the path your application is located, you can use Assembly.GetExecutingAssembly()
, and the CodeBase
property or GetName()
method
string fullAppName = Assembly.GetCallingAssembly().GetName().CodeBase;
string fullAppPath = Path.GetDirectoryName(fullAppName);
Don't fight the system.
Microsoft does not want you to use the program files folder for anything other then assemblies. Config files should go in Application Data, Save files and the like which users need to know about go in My Documents.
jalf's answer will work but you are fighting the system. Unless their is a really good reason why you want to know what folder your assembly is in then I would suggest against it.