.netwindowsvisual-studio-2013installationwindows-users

How to control post-install behavior of a program for users with different Windows permissions


I have a Visual Studio Installer Setup Project that outputs a .msi file for installation on systems. I'm using Visual Studio Pro 2013 with .Net 4.0.

The application is mainly intended to be used by non-admin Windows 7 users. However, due to user restrictions, the program gets installed on the computers on an admin account with InstallAllUsers set to True.

The deployment project adds a shortcut on the desktop and in the programs menu.

After the installation, the flash drive from which the program is installed is removed, and the application is manually launched through the shortcuts on the admin account with no problems.

A problem is encountered however, when the application is launched for the first time on a non-admin account using the created shortcuts. This is where the following error occurs:

An installation package for the product MyApp cannot be found. Try the installation again using a valid copy of the installation package 'MyApp.msi'.

The interesting bit is that if I try to launch the executable directly from the Program Files folder, it works just fine. I can even create a shortcut manually and that will work as well. Finally, if I actually do direct the program to the .msi file in the flash drive, the problem goes away. But this is manually intensive especially if it has to be done on multiple non-admin accounts on the computer. I want to be able to install the program once on an admin account and forget.

Why am I getting this error? Why is Windows looking for the .msi file after the app has been installed? Is there a way to avoid it through changing some property in the deployment project?


Solution

  • Upon much more research, I have discovered that the reason Windows attempts to find the installation file is because the shortcuts created in Visual Studio Installer Setup Projects are advertised shortcuts (vs non-advertised shortcuts). Advertised shortcuts let Windows repair the installation by replacing any missing files the shortcut points to (similar problem here).

    It seems that Visual Studio Installer Setup Projects do not support non-advertised shortcuts although they can be tricked to install them (more info here).

    Furthermore, I must also have a problem in my install project because at launch Windows believes it needs repair it. As such, I have decided to switch to WIX from Visual Studio Installer Setup Project. WIX should give much more control over exactly what I want to install and although I don't plan on using non-advertised shortcuts, it supports them.