1

We have a little situation here. We are writing an ini file at install-time using following code segment:

<Component Id="_CFG" Guid="{CADE766F-3AF0-40A6-9D35-12AC4FD5B278}" Feature="DefaultFeature" KeyPath="yes" Location="either" NeverOverwrite="yes">
 <CreateFolder Directory="CFG" />
 <Environment Id="SharedAppend" Name="Path" Value="[CommonFilesFolder]Company Shared\MyDir" Separator=";" Action="set" Part="last" Permanent="yes" System="yes" />
 <IniFile Id="MyCFG.ini1" Action="addLine" Directory="CFG" Key="LOCAL_ROOT" Name="ata.ini" Section="ALIAS" Value="[CommonAppDataFolder]Company\MyDir" />
  <IniFile Id="MyCFG.ini73" Action="addLine" Directory="CFG" Key="APPLICATIONS" Name="ata.ini" Section="GENERAL" Value="Product1;Product2;Product3;Product4;" />
 <RegistryValue Id="Registry47asdf" Root="HKLM" Key="SOFTWARE\Company\MyProd" Name="LocalRoot" Value="[CommonAppDataFolder]Company\MyDir\" Type="string" />
</Component>

This installation is conducted by an Admin user. Now a 2nd user (Standard) modify this file via some application. After that when a 3rd user would logged in and launch the application, Windows Installer Progress Dialog appear and that would restore the file to original one.

I thought, "NeverOverwrite" would prevent this, but it didn’t worked.

I’m assuming that "NeverOverwrite" attribute may not be applicable on element.

Anyone have any idea how to prevent this file from restoring by Windows installer service?

Thanks a bunch..

Farrukh Waheed
  • 2,163
  • 2
  • 29
  • 59

1 Answers1

0

Modification of an ini file should not trigger Windows Installer Resiliency. What happens is that a component will be reinstalled when its keypath (i.e. a certain file or registry entry) disappears.

So you need to figure out these things:

  1. Which component installs the INI file? (I suppose it is not the component you show in your question, because that one only modifies INI files.)
  2. What is the keypath of that component? (If it is not marked explicitly, wix will take the first file or registry entry in that component.)
  3. Why is the keypath file or registry entry disappearing, thus triggering the reinstallation of that component?

Also, you might want to consider putting the ini file in its own component. This way, it will be its own keypath and it will only be reinstalled by the windows installer resiliency mechanism when it actually disappeared (and not when some other file or registry entry disappears.)

Community
  • 1
  • 1
Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
  • Wim, thanks for detailed response. Your point 3 is the one, I tried to correct in my code. In fact, the whole Component was KeyPath='yes', so I moved Keypath to the registry key. I'm just waiting for the build to come out and will evaluate then. Thanks – Farrukh Waheed May 01 '12 at 06:58