How to get the path of app(without app.exe)?

Posted by iPhoney on Stack Overflow See other posts from Stack Overflow or by iPhoney
Published on 2009-05-19T06:33:31Z Indexed on 2010/04/21 13:13 UTC
Read the original article Hit count: 224

I want to get the path of my app like: "\\ProgramFiles\\myApp", I try to use the following code:


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

But it returns a path which has "\\myapp.exe" at the end.

I also tried:


string path = System.IO.Directory.GetCurrentDirectory();

But it throws an “NotSupportedException”.

Is there any way to get a path without .exe at the end?

© Stack Overflow or respective owner

Related posts about c#

Related posts about filepath