views:

261

answers:

2

I'm using VS2005.

After I install an application using an .msi. Everytime this application loads it tries to find the setup and installs itself again if a file has been modified. If I delete the .msi file then the application can't even load.

Is there a way to remove this link between the application and the msi?

I'm sure it's only a checkbox somewhere.

Thanks!

+1  A: 

You're installing an Advertised Shortcut, this means when you double click on the shortcut to run the application Windows Installer checks to ensure that all files, registry keys, etc that should be installed are installed.

For some reason Windows Installer is detecting that your installation has become "corrupt", this might mean that a file has changed, been deleted, registry keys are missing or whatever.

If you install a non-advertised shortcut you'll stop the repair happening. However the better solution is to try and figure out why it's attempting to repair your installation. Generally it's an indication that you've got a problem with your application or installation design - any "key file" in a component isn't permitted to change by default and will be "repaired" if it's modified. You probably don't have any other options in Visual Studio, as it's fairly limited.

I'd highly recommend picking up a copy of The Definitive Guide to Windows Installer, it explains all the Windows Installer concepts clearly using VS2005 and showing how to work around some of the limitations by editing the MSI with Orca.

Edit: (Looked up the in book for you...) you probably need to add DISABLEADVTSHORTCUTS to the Property table with a value of 1. I don't use VS so I can't say if there's a checkbox or not.

You might also be able to "cache" the MSI in the Windows folder, this means you can still repair even if the original MSI is deleted. Again, unsure how to do this with VS.

sascha
Thanks for the info!Here, they have an in-house upgrade system and when the application got upgraded it causes this problem.I'm now running the msi using: msiexec /i Setup.msi DISABLEADVTSHORTCUTS=1
the_lotus
+1  A: 

One thing to note is that MSI is a release and deployment mechanism - it is not geared towards interactive testing where you install the MSI and then change the installed files afterwards - like you do during development.

The whole technology is designed to strictly install what's in the MSI file and to maintain the deployed configuration and protect it from manual or accidental changes. This can be extremely annoying on systems where manual changes are performed as part of testing or development, but the MSI file is actually just "doing its job".

As sacha says there are several ways you can disable or work around this behavior:

  • Use non-advertised (regular) shortcuts
  • Set the DISABLEADVTSHORTCUTS property
  • Launch the EXE file the shortcut points to directly (this bypasses MSI entirely - and can be used to launch the app if the original MSI is missing)

Then there are several more advanced options that isn't really recommended. For example you can identify all the files that may need manual tweaking, and disable the repair behavior specifically for these files. This is generally done by setting a blank GUID to the hosting component for the file, or to set the component attribute "never overwrite if key path exists" (msidbComponentAttributesNeverOverwrite). There are several other advanced tweaks, but nothing that's really recommendable.

Also note that it is not just advertised shortcuts that can trigger repair. Invoking advertised COM servers or advertised file extensions may also trigger self-repair.

If you run into a situation where the MSI keeps asking for the source, just uninstall the MSI from add/remove programs to get rid of the program registration on the system. Then you can reinstall it with a freshly built MSI.

Glytzhkof
Good point re: COM servers, I forgot about those. Oh the pain they have caused me in the past ;)
sascha
Don Box once commented that "COM is love" - nuff said. Crippled love I'd say.
Glytzhkof