Search code examples
c#pathsetup-project

Set installation path in windows Application Setup


i created a setup application for a windows forms application, i changed th "Default Location" property to [D][GestionStock][GestionStock] in order to install the application in this directory and i set "AlwayCreate" property to true. but this doesn't create the custom folders and install the application directly in "D" drive.

How to set installation path to a custom folder like [D][CustomFolder][CustomFolder] and create folders during the installation?


Solution

  • It looks as if you are inventing property names that don't exist, such as D and GestionStock in square brackets. The brackets mean that they are Windows Installer properties, either standard or created by something in your setup. So D is not a property name, and neither is GestionStock.

    These are the standard properties:

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa370905(v=vs.85).aspx

    So if you want a folder with GestionStock in the name, just use it without the brackets. This might also be useful because it describes how to construct folder locations using strings and properties:

    https://www.red-gate.com/simple-talk/dotnet/visual-studio/getting-started-with-setup-projects/

    such as [ProgramFilesFolder][Manufacturer]\NewSetup where the bracketed names are property names.

    The main problems you have are:

    1. Setups are expected to install to standard folder location property names such as [ProgramFilesFolder], [CommonFilesFolder] and so on because they work on all systems. In your case your setup is assuming that all systems have a D: drive, which they don't. If you want to try installing to the D: drive, just try D:\Gestion\Gestion if that is the location, forgetting brackets.

    2. There is a browse dialog that users expect so that they can choose the installation location, not you.

    3. Windows really wants you to install your binaries to ProgramFiles, for the app and the install to store data in AppDataFolder (the Windows Installer property name) and so on. Going against this model will make your setup more difficult.