Reputation: 59
I have a VS2010 installer project I am using to create an .MSI file.
Within the MSI file I have some configuration files that are such as myproduct.exe.config. This file may or may not get updated between versions.
While transitioning from version 1.0.1 to 1.0.2, this file was updated.
I have MSI files that exist for version 1.0.1 and 1.0.2.
To test that upgrades work properly I do the following:
Install MSI file from v1.0.1
Install MSI file from v1.0.2
What I am noticing is that after installing the v1.0.1 MSI, my file myproduct.exe.config exists as it should. However upon running the v1.0.2 MSI file to upgrade, the file disappears. Checking the verbose windows installer log files I see the following message:
MSI (s) (20:C8) [13:23:18:106]: File: C:\Program Files (x86)\xxxx\xxxx\myproduct.exe.config; Overwrite; Won't patch; Existing file is unversioned and unmodified - no source file hash provided to compare
I have read many things and believe this is happening because I cannot version this plain text configuration file. My desired end result is for this updated file to always be installed and never left out.
Can anyone provide guidance?
Upvotes: 0
Views: 728
Reputation: 521
I think you're looking for File Versioning Rules
Nonversioned Files are User Data—If the Modified date is later than the Create date for the file on the computer, do not install the file because user customizations would be deleted. If the Modified and Create dates are the same, install the file. If the Create date is later than the Modified date, the file is considered unmodified, install the file.
And have a look on Companion Files. It will help you to solve your problem :)
Upvotes: 0
Reputation: 20800
RemovePreviousVersions in VS setups should work fine. This is a good place to start:
https://www.simple-talk.com/dotnet/visual-studio/updates-to-setup-projects/
It's still relevant except that you must increment file versions to update file because the upgrade is now at the end and file overwrite rules apply. The other issue is that VS upgrades broke, see this fix:
http://support.microsoft.com/kb/2418919/en-us
which may be the problem you are seeing. You should not need any REINSTALLMODE stuff to make a routine VS RemovePreviousVersions work ok.
You don't have much control over data files in VS upgrades because VS doesn't let you hash the files or use companions. The overwrite rule is that if the file has been altered after installation then it won't be replaced, the assumption being that the user has changed it.
Upvotes: 0
Reputation: 59
I think I have more reading to do on behavior of MSI installs in general. For the time being I have overcome my problem by setting the RemovePreviousVersions property to false and the REINSTALLMODE property to "amus".
I was able to observe while RemovePreviousVersions Property was true, my updated file would be installed and then removed later on. Disabling this property corrected that.
For good measures I set the REINSTALLMODE property to amus, rather than the default of omus. More details on REINSTALLMODE can be found here http://msdn.microsoft.com/en-us/library/aa371182(v=vs.85).aspx
Upvotes: 0