file marked as key file not getting unistalled while using installshield - installshield-2012

I am creating msie using installshield2012 professional.I am adding one of my project primary output to msie ,component of which is marked as key file.If i don't mark it as key file my custom installer file in project doesn't get called which is trouble for me but marking it as key file keeps the files uninstalled after uninstalling application.
Is there any way to delete the key files??(permanent and shared properties are set to NO)

InstallShield MSI packages work with Windows to determine which files should get removed and which should be left behind during an install. If the file is a shared DLL used by other applications, it will be left behind during install. If the file is still in use (perhaps a service or system tray app), it will be left installed only until the next reboot. You can always check the Windows Installer log files to determine why a file has been left behind, but here are a few easy things you can try:
First, determine which component the file is the key path of and then switch to the "Components" view in InstallShield 2012 and highlight the component. Review that component's attributes.
1) make sure that Permanant = No.
2) If you are confident this file is not shared with other applications, you can set Shared = No.
3) Reboot after your uninstall test to see if the file gets removed during a reboot.

Related

Proper way of installing per-user files during a per-machine installation

I have a per-machine WiX installer (InstallScope="perMachine" InstallPrivileges="elevated") and I need to create a folder and copy a few files to the Documents folder of each user running the application. At the moment I install the files to a personal folder of the current user, but that's wrong and I get the ICE91 verification warning:
ICE91: The file 'SomeFile' will be installed to the per user directory 'SomeDir'
that doesn't vary based on ALLUSERS value. This file won't be copied to each
user's profile even if a per machine installation is desired.
I want the files to be automatically copied to the Documents folder of each user. Could someone post the step-by-step instructions how to do that?
UPDATE: I will be on holiday until September, during that time I will not be able to respond to any comments.
Windows Installer will do this - it's what advertised shortcuts will do. If you install a file to a user specific folder location and a different user logs on, then that file will be missing for that user and repair mechanism of the advertised shortcut repair will install it from the original MSI file. In your case the PersonalFolder property is the user's Documents folder.
To arrange this, the file must be the keypath of a component, and that component must be in a feature with an advertised shortcut. When the shortcut is used the component and containing feature are checked for "self healing" and the missing file installed. This works for users that don't yet exist. Older Office installers once did this to install user-specific items such as templates.
The MSI must obviously be available for this to work, and there is no mechanism to remove the files at uninstall time.
An alternative (or if there are no advertised shortcuts) is to add code to the app that calls MsiProvideComponment (or equivalent p/invoke) passing the ProductCode, feature name, Component id (of that documents file) and use INSTALLMODE_DEFAULT, which will install the file if it's missing as documented here:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa370356(v=vs.85).aspx
and it will be missing and therefore will be installed for a user who has not run the app before.
Why would you want to do this this way? What if there are 10000 (just for example) users on the machine? You want to copy the files to all 10000 documents folders taking up potentially GBs of space (depending on the size if the files copied)? If these are configuration options needed by your app, the app itself should create default files in the user's documents location on the first run if they are not present otherwise load the settings from these files. You should not put the default files there for every single user on the machine at install time.
This approach also fails for new users added after you install. How will they get the files in their documents folder? Do they have to reinstall the product?
Consider a per machine install of per user installers with shortcuts that interested users could launch. For example, templates.msi, examples.msi.

Upgrading doesn't update VirtualStore file

I haven an installer which must run with elevated admin rights if UAC is enabled. This works fine. When I upgrade the app (using the MajorUpgrade element) the app gets uninstalled and reinstalled correcly.
During runtime the app attempts to change some files in the program files folder which places copies them items in the users virtualstore. These do not get removed during uninstall.
During the upgrade/reinstall process, is there a correct way to delete the application file copies, for all users, in the VirtualStore?
Files placed into a virtual store are, by definition of who wrote them and when, per-user data files. Such files typically should not be removed during uninstallation. If the files in question are not actually per-user data files, the application that caused them to be written should be fixed to write to a proper location, update them in a controlled fashion, or even not write them at all.

WiX: how to skip removing of iis:WebVirtualDir if virtual directory contains nested directories?

My msi install and uninstall a shared resource: IIS virtual directory "MyTeamServices". And it works very well except it removes that virtual directory during uninstall process even if somebody have created nested virtual directories (not by using installers, just "by hands"). When I expect to see standard behavior of WiX processing HDD folders : if there are "unaccounted" files inside - do not remove folder.
Could you get me ideas how to solve this little problem (and not by using "permanent" attribute)?
Particularly:
1) How to work with WiX sources to understand what is standard behavior during uninstall of WebVirtualDir (and may be patch it)? I see the ParseWebVirtualDirElement but that not make me closer to IIS management actions. Where they are, how to dig out them?
2) I could also write custom action that could alarm if virtual directory contains something unexpected "inside", but where to call it, and how then skip WebVirtualDir uninstall ? Component can be uninstalled but the actions of WebVirtualDir uninstall process should be skipped... Or I should play there with msi "features",e.g Move this component to feature and then somehow to skip feauture's uninstallation?
See the answer in the linked question.
It brings reference count into IIS virtual directory - they won't be deleted if it is used by another product.

How to use WIX CopyFile element to copy file on change/repair to a system folder without installing it to the target?

I have a problem which is related to the execution of CopyFile on change/repair when using WIX to make a msi setup.
I have a feature which has a component which copies/moves a file from the source folder to a folder already present somwhere inside a users system. It is not the folder of my application. I am only moving this file and not installing it to the the target. This feature works fine if I install it using a complete setup. But when on initial install I chose not to install this feature and then try to install it during a " change " all other custom actions/components inside the feature are executed/installed except for the CopyFile component. This is critical to my setup and if it does not get copied my setup will fail.
Just wondering if anyone found a solution to a similar problem or ever came across a similar issue?
The component which contains the CopyFile operation is configured incorrectly. It should have an actual file or registry entry as a key path.
Although Windows Installer uses components to manage resources, the component key path is main factor which decides if the component is installed or not.
So a component without a resource as a key path will never be installed and the CopyFile operation it contains will never be executed.

how to copy a file and then conditionally remove it

(I'm newbe in Installer world so I'm still not sure what is right what is wrong. Anyway.)
I make a installer for service which uses desktop database. The database file should somehow be copied during first installation, be intact during upgrades and finally removed during uninstall.
As far I know, I can't add the database file as a directory component - 'cause installer will automatically remove it during uninstall. On the other hand, if I set the Persistent attribute, the database file will be NEVER removed by installer (even, if I will create separate component with RemoveFile element).
The above leads me to thinking, that I can't add the database file as directory's component.
So what are other options?
Is it possible to include a file into installer file (msi) and then copy the file with custom action to target folder?
Then deletion could be solved with RemoveFile element and condition base on UPGRADINGPRODUCTCODE property.
What do you think, guys?
If you are going to be using a custom action, why not create a custom action the will remove the file on uninstall. I have a custom action like that in a couple of my installers due to updates that happen to the target folder after the program has been running for a while. this just ensures a clean uninstall with no files laying around.