views:

60

answers:

3

Hi,

I have a .NET 3.5 Setup Package Project which installs my application successfully.

The setup package deploys a number (around 70) custom files for use from within the application.

From time to time I have the requirement of deleting some of these files, however upon restarting the executable, it automatically runs a portion of the Setup MSI again, and re-installs these files.

The only way I can achieve my desired result at the moment is to delete the files after starting the executable.

I have looked through the attributes on the files in the setup package such as Vital and PackageAs, however cannot seem to identify the required setting to achieve this.

Does anybody have any idea what is needed to acheive this ?

Much thanks

+1  A: 

This has annoyed me too, and I don't know the specific setting you have to change to prevent this, but I can tell you a work-around that I've used. I found that it only happens when I run the application from the shortcut that was installed as part of the installation. So, if you create a new shortcut to the application and run it via that shortcut, then the files you've deleted won't be automatically restored.

Charles
Thanks Charles, this workaround works a treat.
Duncan
A: 

Windows Installer supports three types of product upgrades: major upgrades, minor upgrades, and small updates. A synopsis of which upgrade to use under what circumstances can be found here: http://helpnet.flexerasoftware.com/robo/projects/installshield12helplib/MajorMinorSmall.htm

What you want to do is set you installer up in such a way that the new version of your software sees the file deletions as upgrades to a prior version. If you fail to do this and then you delete files, the program installation thinks it is damaged, and tries to restore the files you deleted when the program is executed again.

In InstallShield (the installer product with which I am familiar), there is a Product GUID and an Upgrade GUID. The Upgrade GUID always stays the same within your product family of different versions. The Product GUID changes with each new MAJOR or MINOR release. In general, if you follow this pattern, and then specify file deletions in your new version, the installer should interpret the file deletions as upgrades, and you should not get any errors on subsequent execution of the newly-installed version.

Robert Harvey
thanks Robert, Just going through this concept on the Windows Installer. The issue is more relating to starting the same version executable - which triggers a re-install, rather than an issue caused by an upgrade.The Upgrade GUID and Product GUID should be the same as it is the same MSI. Thanks
Duncan
The only way to safely delete files from an installed program is to perform an upgrade.
Robert Harvey
A: 

From http://msdn.microsoft.com/en-us/library/kz0ke5xt%28v=VS.100%29.aspx

" How do I turn off repair for a file that users are expected to modify or delete?

Visual Studio creates advertised shortcuts so that when the program is started it verifies that all its files exist. To change this behavior and cause it not to repair the file, select the files in the setup project and change the Condition property to NOT REINSTALL so that the file will not get reinstalled on a repair and its Transitive property to TRUE so that the condition is re-evaluated. This will cause the Installer to flash on the screen the first time after the file is deleted, as it verifies that the file should not be reinstalled, but you will not see the installer after that. "

Igorek