[wix-users] How to use if..else condition in Wix toolset?
Farrukh Waheed
farrukh1 at gmail.com
Wed Oct 26 03:24:43 PDT 2016
Joel,
<?if?>... <?else?> are Preprocessor conditional constructs. These would
only evaluate at build time but not on installation time.
Please see following links to use FileSearch element (may be using Util
extension), to better understanding:
http://wixtoolset.org/documentation/manual/v3/xsd/util/filesearch.html
http://stackoverflow.com/questions/6519076/wix-check-file-exists-before-install
http://stackoverflow.com/questions/34299415/wix-file-search-conditional
You could enhance your code snippet using above links..
On 26 October 2016 at 14:37, TMG Test <gpattmgtest at gmail.com> wrote:
> Below is my code
>
>
>
> <Property Id="FOOFOLDER">
>
> <DirectorySearch Id="DirSearchFoo" Path="C:\foo">
>
> <FileSearch Id="barSearch" Name="bar.txt" />
>
> </DirectorySearch>
>
> </Property>
>
>
>
> Now I want to check below condition. If bar.txt exist in the above
> location the I have to set the install path as C:\foo
>
>
>
> Else I have to set the path as C:\Test
>
>
>
> How to accomplish this in .wxs file using <?if?> ..<?else?>
>
>
>
> Could you help, please?
>
>
>
> Thank You,
>
>
>
>
>
>
>
> From: Joel Budreau [mailto:joel.budreau at gmail.com]
> Sent: Monday, October 24, 2016 9:51 PM
> To: gpattmgtest at gmail.com
> Cc: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] How to use if..else condition in Wix toolset?
>
>
>
> Use the <FileSearch> element to build an AppSearch entry that looks for
> the presence of web.config. If it's found, have a custom action overwrite
> the directory property associated with the files you need to install (make
> sure this directory-overwrite action is scheduled after CostFinalize).
>
>
>
> On Mon, Oct 24, 2016 at 4:58 AM, TMG Test <gpattmgtest at gmail.com <mailto:
> gpattmgtest at gmail.com> > wrote:
>
> Hello Team,
>
> Here is my requirement: if web.config file exists in
> D:\default\website\web.config I have to copy some files to
> D:\default\website location else copy the same files to C:\inetpub\wwwroot
> location.
>
> How to write this condition in .wxs file?
>
> Could you help, please?
>
> Thank You,
>
>
>
>
> ____________________________________________________________________
> 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