Havodion
Havodion

Reputation: 3

WPF Application Installs Each Time I Open It via Shortcut

What I Have Done:

I created a Visual Studio Setup Project that creates the installer for my WPF application. This installer creates the MSI I use to install the application.

I created a Primary Output with my primary project and created a shortcuts to this.

The application installs successfully.

Problem:

When I click the shortcut that was created on the desktop I get the following screen before the application loads and starts:

Header: [Application Name]
Message: Please wait while Windows configures [Application Name]
Loading Bar Header:
Gathering required information... (Followed by a progress bar and a cancel button)

This takes up unnecessary time. The application starts after this finishes and continues as intended.

How can I prevent this from happening, what reasons could there be for this to happen?

PS: when I open the application from the exe in the program files this does not happen.

Upvotes: 0

Views: 612

Answers (2)

PhilDW
PhilDW

Reputation: 20780

This nearly always happens because people are unaware of the fact that if they install a file (or registry entry) and then delete it later a repair will be triggered by using an advertised shortcut. There are other entry points into repair, but shortcuts are the obvious one. Attempts to defeat repair are often pointless because there are other things that can prompt a repair of a changed product. such as upgrades, patches, and the user right-clicking the MSI to repair, or doing repair from Programs and Features.

Another cause is that the setup installs an item (such as a file or registry entry) into a user profile location (such as User's data) in an Everyone install. The is installed for the installing user, but not for another user so repair will install it. However you'd see this just once per new user.

There have also been VS setup project bugs that can cause this issue.

The documented way to prevent repair for files you want to remove after install is to null the Component Id for the file, something VS setups don't support so you need to do it with something like Orca or post-build MSI script. See ComponentId here:

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

Note that the Windows Installer team recommends the MSI source be available anyway for a number of reasons, rule 31:

http://blogs.msdn.com/b/windows_installer_team/archive/2006/05/24/605835.aspx

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55581

Visual Studio Setup Project authors advertised shortcuts which is one of the mechanisms that MSI uses to determine if a repair is needed. It is detecting it is needed and attempting to do so but failing resulting in an infinite repair loop. Please read:

Windows Installer launches unexpectedly, for no obvious reason

This will help you identify which component is causing a problem. Unfortunately, VS Setup Projects are quiet limited and it's going to be difficult to fix this problem. I really would recommend a better toolset such as WiX, Advanced Installer or InstallShield.

Upvotes: 0

Related Questions