开发者

WIX: Override IniFileSearch while installing if MSI has command line params

In my WIX setup project, I am reading some properties from an INI file.

Is there a way to override the IniFileSearch during installation if any of the Property values are passed as command line params. (I am trying to do this so that it works with silent installations开发者_StackOverflow中文版 as well.)

Code Snippet:

<Property Id="WEBDIR" >
   <IniFileSearch Id="WebsitesDirIni" Name="Setup.ini" Section="InstallLocations" Key="WebsitesDir" Type="raw"/>
</Property>

What I'd like is that if I were to execute the msi as shown below, it accepts the value given by the command line param rather than looking up a value in the ini file.

msiexec /i install.msi WEBDIR=C:\MyOverriddenPath


INI file searches can search only in the Windows directory. So for your scenario you can try using the custom action mentioned in this thread: Get INI file value with WiX

This way you can simply condition the custom action with the property you set from command line.


Your example will set WEBDIR to the command line value which is then replaced by the ini file value.

You can achieve the result you want by using a different command line property name and setting WEBDIR to that value if defined. i.e.

    <SetProperty Id="WEBDIR" After="AppSearch" Value="[DIR]">
        DIR
    </SetProperty>

Note that this is supplimental to your existing code. You could then call :

msiexec /i install.msi DIR=C:\MyOverriddenPath

Which would override the WEBDIR property defined in the ini file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜