Archive

Posts Tagged ‘Install Location’

Using a Post-Build Script to set the InstallLocation property in VS Setup Projects

December 14th, 2008

If you check the registry for (un-)installation information about installed applications, you can notice that the InstallLocation registry key is mostly empty. This is because most installers do not set ARPINSTALLLOCATION property to the value of [TARGETDIR] during installation. Unfortunately, this also includes Visual Studio setup projects:

image

 

What we can do so solve this problem is inserting a simple Type 51 Custom Action into the installer. What I was looking for, was an easy solution to automate this tasks (rather than editing them with ORCA or any other tool), and I eventually came up with a post-build event that updates the MSI database directly. Fortunately, I had a similar script in place from an earlier setup, so adjusting it was quite easy 🙂

 

In the link below, you can find a VBS script (SetArpInstallLocation.vbs) that inserts the required custom action for you and makes sure the ARPINSTALLLOCATION property is set during installation. All you have to do is calling the script during the post-build event of your setup project.

In the sample below, the script file has been placed in the same folder as the installation project. Accordingly, the build action looks like this:

"$(ProjectDir)SetArpInstallLocation.vbs" "$(BuiltOuputPath)"

 

image

 

If the installer file is re-built with this script in place,  the installer writes the InstallLocation properly to the registry during installation 😀

image

 

Download VBS script file: SetArpInstallLocation.vbs

Author: Categories: .NET, Deployment Tags: ,