Wix modify an existing ini file

2020-04-05 01:50发布

问题:

I was trying to modify an .ini file in Wix

If it does not exists, the msi does not complete....

  1. how do I check for this
  2. I really want to modify it

Yes I looked at other stackoverflow questions/answers and on google

I was trying this...

      <Component Id="TestIni" Guid="*">
        <CreateFolder />

        <IniFile Id="Ini1"
                 Action="createLine"
                 Directory="INSTALLLOCATION"
                 Section="Test"
                 Name="Minimal.ini"
                 Key="TestKey"
                 Value="TestValue" />

        <IniFile Id="Ini2"
                 Action="createLine"
                 Directory="WindowsFolder"
                 Section="Test"
                 Name="Minimal.ini"
                 Key="TestKey"
                 Value="WindowsFolder TestValue" />

      </Component>

回答1:

Use Action="addLine" or Action="addTag" if you want to modify an existing value.



回答2:

You could use the FileSearch element to set a property and then use this property in a condition.