8

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>
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164

2 Answers2

9

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

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
  • how do I check for if the Minimal.ini file exists? Say I need to check to see if it is in C:\MyIni\LocationIni\ –  Jun 07 '13 at 23:41
  • 1
    Action="addLine" or Action="addTag" will do the right thing whether the .ini file exists or not. – Bob Arnson Jun 07 '13 at 23:43
  • changed the createLine to AddLine on both, but still errors , I then noticed I had left { } around GUID , I removed those, same issue –  Jun 08 '13 at 00:17
  • I forget, I moved on to something else.... sorry. It was just stopping the msi from running –  Jun 12 '13 at 18:04
0

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

A.Game
  • 459
  • 4
  • 16