[wix-users] Best Practice Question: How to load and display options from an ini file ?

Phill Hogland phill.hogland at rimage.com
Mon Apr 25 10:25:59 PDT 2016


I think what you are looking for is to use a wixlib and possibly defining in the hosting project a WixVariable (not a Burn Variable) which is used in the wixlib authoring, to affect  runtime behavior of the wixlib authored code.  The wix toolset src\Setup project used to install the WiX Toolset also uses a wixlib so that may be a starting point.  I put as much code as I can, that has any chance of being reused, into wixlibs.  I have a wixlib that is common to all of msi packages, and another wixlib that is common to all of my bundles, in addition to other wixlibs for special purposes.

preprocessor Variable(s) are processed prior to compiling by candle.exe and so preprocessor logic is static at runtime.

________________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Gary M <garym at oedata.com>
Sent: Monday, April 25, 2016 11:59:18 AM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Best Practice Question: How to load and display options from an ini file ?

Thanks Sanket,

The pre-processor foreach loop seems to require early binding of referent
data. Maybe I have another race condition ?  I think I also need a
customaction.


I did get the ini file in a arbitrary directory.

I was hoping for ini file read and write code that wasn't so verbose.

I was trying to get some code that wasn't so verbose..

Write Ini File:
  <Fragment>
    <DirectoryRef Id="APP_ADMIN_DIR" >
      <Component Id="set.APP.INI.CFG"
Guid="{C4CB3CD1-DD79-4836-9EBD-9FFCFBC355E5}" KeyPath='yes'>
        <IniFile
          Id="set.APP.HOST.NAME"
          Directory="APP_ADMIN_DIR"
          Name="application.ini"
          Action="addLine"
          Section="host"
          Key="host_url"
          Value="'[APP.HOST.NAME]'"
        />
       </Component>
    </DirectoryRef>
   </Fragment>

Read Ini File:
    <Property Id="APP.HOST.NAME" >
      <IniFileSearch Id="get.APP.HOST.NAME" Name="application.ini"
Section="host" Key="host_url" Type="raw" >
        <DirectorySearch
          Id="getAPP.INI.DIR.REF"
          Path="[APP_ADMIN_DIR]"
        />
      </IniFileSearch>
    </Property>




On Sun, Apr 24, 2016 at 11:25 PM, Sanket Panchamia <psanket at gmail.com>
wrote:

> Hi,
>
> There is an IniFileSearchElement that will serve the purpose for you.
> However the ini files need to be in the system folder for this element to
> work.
> Else, I have implemented my own parser in a custom action using
> GetPrivateProfileString
> WritePrivateProfileString
>
> Hope this helps.
>
> Sanket
>
> On Mon, Apr 25, 2016 at 6:36 AM, Gary M <garym at oedata.com> wrote:
>
> > I have another nube question. How 'should' I load options into a combobox
> > from an ini file ?
> >
> > The second part... How should I parse the text string once loaded the
> > option is selected ?
> >
> >
> > thx
> > -g
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant
> > http://www.firegiant.com/
> >
>
>
>
> --
> Regards
> Sanket Panchamia
> +91-9742836299
>
> <https://twitter.com/p_sanket>  <http://www.facebook.com/spanchamia>
> <http://www.linkedin.com/in/psanket>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/



More information about the wix-users mailing list