Skip to content

MSI Installer Application Folder from code

To deploy our code we create MSI installers using Visual Studio. One problem I encountered is that there is no property available in code to know where the user has chosen to install the application.
After some searching and testing I now use the following code to get the installation path:

// Installer Application Folder
string installPath = Context.Parameters["assemblypath"];
installPath = installPath.Substring(0, installPath.LastIndexOf("\\"));

if (!installPath.EndsWith("\\"))
    installPath += "\\";

That's all!