I am working on WIX Installer. I am trying to read Directory path from .ini file to XML. I have to red the path and get the files installed to that particular path.
<Property Id="ROOTDRIVE">
<![CDATA[*value which is read from .ini file has to be passed here*]]>
</Property>
<Property Id="MY_PROPERTY">
<IniFileSearch Id="myIniSearch" Name="localtest.ini" Section="ENVIRONMENT" Key="LocalDirectory" Type="raw">
<DirectorySearch Id="SPIniFilePath" Path="C:\">
<FileSearch Id="SPIniFile" Name="localtest.ini"/>
</DirectorySearch>
</IniFileSearch> />
</Property>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir" >
<Directory Id="myIniSearch">
<Directory Id="INSTALLFOLDER" Name="!(bind.property.ProductName)" />
</Directory>
</Directory>
</Fragment>
localtest.ini is the .ini file. It is in the C drive
[ENVIRONMENT]
LocalDirectory=D:\Ng
Files should get installed to the path specified in .ini file. Following I added CustonAction. Still it gets installed in C drive
<Property Id="MY_PROPERTY" Secure="yes">
<IniFileSearch Id="myIniSearch" Name="localtest.ini" Section="ENVIRONMENT" Key="LocalDirectory" Type="raw">
<DirectorySearch Id="SPIniFilePath" Path="C:\">
<FileSearch Id="SPIniFile" Name="localtest.ini"/>
</DirectorySearch>
</IniFileSearch>
</Property>
<CustomAction Id="MyAction.SetProperty" Return="check" Property="MyAction" Value="[MY_PROPERTY]" />
<InstallExecuteSequence>
<Custom Action="MyAction.SetProperty" After="AppSearch" />
</InstallExecuteSequence>
<DirectoryRef Id='MY_PROPERTY'>
<Directory Id='INSTALLDIR_SimpleWebApp' Name='SimpleWebApp' />
</DirectoryRef>