Search code examples
c#smartphone

How to obtain the path of the application in smart device application?


I am develpoing smart device application in C#. I want the exact path of my application. My application resides on my machine at F:/MobileAppl/ManagedAppl.

So I want this path in smart device application.

Please make sure that all the functions of .net framework does not work in .net compact framework.

Can you provide me the code or link through which i can resolve the above issue?


Solution

  • This should work well for both windows application and mobile application

     string path;
     path = System.IO.Path.GetDirectoryName( 
     System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
    

    link text