How to get Application Startup Path And Installation Path?

Peace be Upon You,

First of all i mean by startup path; the path of the exe of your application, and for the installation path; the path to where your application will be installed using an installer project.

1- Startup Path:

If you used Environment.CurrentDirectory or Directory.GetCurrentDirectory() you will find that the returned path is affected by any open file dialog you might have opened during running your application, so it won’t return to you the application actual startup path.

You can use this instead AppDomain.CurrentDomain.BaseDirectory which will always return you the application startup path.

2-Installation Path:

You can get this by doing the following steps:

  • Make a CustomActionInstaler class
  • Point to it from the installer project
  • Open the CustomActions view from the installer and then go to the properties of the CustomActionInstaller that we just pointed to in the previous step.
  • There is a property named by CustomActionData set it to /targetdir=”[TARGETDIR]\”. The key “targetdir” will be used later for getting the installer application directory and the actual value is “TARGETDIR” but the square brackets and slash are for empty spaces in the application path.
  • Call Context.Parameters[“TargetDir”], this will return to you the installation path of your application.


How To Add Localized Satellite Assemblies To Visual Studio Installer

Peace be Upon You,

This can be done simply as follows:

1- Go to the installer project and open the Files system editor.

2-Right click on Application Folder and select Add/Project Output

3- Select the project containing the localized resources and select localized resources from the list of options below the project you selected as shown in the below screen shot.

Screen Shot

Screen Shot

Now you can find the Localized Satellite Assemblies added to your installer package And thats it 🙂


Hello Everyone!

Peace be upon you,

This is my first blog post, i wanted to share my knowledge with everyone mainly about Microsoft technologies, also backup the solutions of any technical issues i faced during my work expereince,  and that’s why i created this blog.

You may find some posts not really too difficult to be done, but i backup this info in case i wanted to get back to it in the future.

Hope it would be helpful for all audience 🙂