[wix-users] WixVariable in a separate wxs

Russell Haley russ.haley at gmail.com
Thu Feb 1 13:32:30 PST 2018


On Thu, Feb 1, 2018 at 9:33 AM, Rob Mensching via wix-users
<wix-users at lists.wixtoolset.org> wrote:
> Don't use a .wxi file. Only use .wxi files to group preprocessor variables. This needs a WixVariable.
> _____________________________________________________________
>  Short replies here. Complete answers over there: http://www.firegiant.com/

Hi, thanks for pointing out that I was very unclear (blush). So this
is the original concern from the OP:

"In my case, I just need to maintain these
variables and the ones with images, logos and icons in a separate file. I
will have to generate this file dynamically by reading some configuration
file and populate the path for these images from that configuration file. I
don't want to modify Product.wxs programmatically for this."

I believe there is also a question from the same poster about setting
the installer images (in a separate email thread).  My thought is to
use the product.wxs file as normal and add a standard WixVariable for
the banners, but use a pre-processor variable from a *generated wxi*
file. That means the installer fragments and source is never altered
(which would be better for source control) and the wxi file can be
generated and stored on a "per whatever" basis (per project, per
client, per feature set).

I pointed to my project because it does *almost* that same thing. I
have a wxi file per project, but the same WIX installer code base.
This can be seen in, for instance, the LuaVersion or LuaInstallCode
(or whatever I called it) in both include.wxi and product.wxs (where
$(var.LuaVersion) is referenced). Thus the reference in the
product.wxs file is to one variable and is not programatically altered
but the source of the pre-processor variable is configurable.

If I'm still misunderstanding, then I apologize for the noise.

Russ

>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Habib Salim via wix-users
> Sent: Wednesday, January 31, 2018 8:48 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Cc: Habib Salim <habib at hsalim.com>
> Subject: Re: [wix-users] WixVariable in a separate wxs
>
> Use a wxi file.  like this:
>
>
> ----------------------------------------------
> <?xml version="1.0" encoding="utf-8"?>
> <Include>
>       <!--  courtesy of :
> http://weblogs.sqlteam.com/mladenp/archive/2010/02/17/WiX-3-Tutorial-Under
> standing-main-WXS-and-WXI-file.aspx
>
>       Versioning. These have to be changed for upgrades.
>       It's not enough to just include newer files.  -->
>   <?define MajorVersion="2" ?>
>   <?define MinorVersion="0" ?>
>   <?define BuildVersion="1" ?>
>         <!-- Revision is NOT used by WiX in the upgrade procedure -->
>   <?define Revision="658" ?>
>         <!-- Full version number to display -->
>   <?define
> VersionNumber="$(var.MajorVersion).$(var.MinorVersion).$(var.BuildVersion)
> .$(var.Revision)" ?>
>
>         <!--  Upgrade code HAS to be the same for all updates.
>         Don't change it.Ever.  -->
>   <?define UpgradeCode="your guid here"?>
>
>
>         <!--  Path to the resources directory. resources don't really need
> to be included
>         in the project structure but I like to include them for for
> clarity   -->
>   <?define ResourcesDir="$(var.ProjectDir)\Resources" ?>
>
>       <!--  The name of our application exe file. This will be used to
> kill the process when updating
>         and creating the desktop shortcut  -->
>   <?define ExeName="HSalimCo.WpfPivotViews.exe" ?>
>   <?define ProductName = "PivotViews" ?>
>   <?define ProductDescription ="PivotViews is a trademark of HSalim & Co.
> Inc." ?>
>   <?define CurrentVersion = !(bind.FileVersion.filWpfPivotViewsexe) ?>
>   <?define ManufacturerName = "HSalim & Co. Inc"?>
>   <?define HSalimCoFolder = "HSalimCo" ?>
>   <?define IconPath = "$(sys.CURRENTDIR)Includes\PivotViews.ico"?>
>   <?define PivotViewsJPEG = "PivotViews.jpg"?>
>   <?define UiBackground = "$(sys.CURRENTDIR)Includes\WixUiDialog.jpg"?>
>   <?define UiBanner = "$(sys.CURRENTDIR)Includes\WixUiBanner.jpg"?>
>   <?define EulaFile = "$(sys.CURRENTDIR)Includes\PivotViewsEULA.rtf"?>
>   <?define SuccessImage = "$(sys.CURRENTDIR)Includes\success.bmp"?>
>   <?define ErrorImage =  "$(sys.CURRENTDIR)Includes\error.bmp"?>
>   <?define SourceFilesDir= "<yourpathhere>\bin\x64\Release"?>
>   <?define DXThemesDir="C:\Program Files (x86)\DevExpress
> 17.2\Components\Bin\Framework\" ?>
>   <?define InstallerActions="<CAprojectPath>\InstallerActions.CA.dll"?>
>
>
> </Include>
> ----------------------------------------------
>
>
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
> Of Ven H via wix-users
> Sent: Wednesday, January 31, 2018 10:11 PM
> To: Edwin Castro <egcastr at gmail.com>
> Cc: Ven H <venh.123 at gmail.com>; WiX Toolset Users Mailing List
> <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] WixVariable in a separate wxs
>
> Thank you Edwin and Rob. In my case, I just need to maintain these
> variables and the ones with images, logos and icons in a separate file. I
> will have to generate this file dynamically by reading some configuration
> file and populate the path for these images from that configuration file.
> I don't want to modify Product.wxs programmatically for this. For example,
> I want to have a separate file like ImageRefs.wxs,  which may have some
> elements like below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
> <Fragment>
>     <WixVariable Id="WixUIBannerBmp" Value="Path_To_CustomBanner_Bmp" />
>     <WixVariable Id="WixUIDialogBmp" Value=" Path_To_CustomDialog_Bmp " />
>     <Icon Id="arpIcon.ico" SourceFile=" Path_To_CustomIcon "/> </Fragment>
> </Wix>
>
> Even though the above compiles properly without any errors and the MSI
> gets generated, the images / icons are not showing during installation. In
> such a case, please advise what would be the best way.
>
>
>
>
> Regards,
> Venkatesh
>
> On Thu, Feb 1, 2018 at 3:45 AM, Edwin Castro <egcastr at gmail.com> wrote:
>
>> Rob's exactly right!
>>
>> I'll repeat what I said earlier, "The code sample really depends on
>> what you have in the Fragment(s) containing WixUIBannerBmp and
> WixUIDialogBmp.
>> ... So if *I don't have anything I can reference*, then ..."
>>
>> If you have a UI element in the Fragment containing WixUIBannerBmp
>> and/or WixUIDialogBmp, then just use UIRef. If there is another
>> element you can reference, then reference that element.
>>
>> Don't do my property hack unless you don't have any other options.
>>
>> --
>> Edwin G. Castro
>>
>>
>> On Wed, Jan 31, 2018 at 11:39 AM, Rob Mensching <rob at firegiant.com>
> wrote:
>>
>>> UIRef?
>>>
>>> _____________________________________________________________
>>>  Short replies here. Complete answers over there:
>>> http://www.firegiant.com/
>>>
>>>
>>> -----Original Message-----
>>> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On
>>> Behalf Of Edwin Castro via wix-users
>>> Sent: Wednesday, January 31, 2018 10:21 AM
>>> To: Ven H <venh.123 at gmail.com>
>>> Cc: Edwin Castro <egcastr at gmail.com>; WiX Toolset Users Mailing List
>>> < wix-users at lists.wixtoolset.org>
>>> Subject: Re: [wix-users] WixVariable in a separate wxs
>>>
>>> The code sample really depends on what you have in the Fragment(s)
>>> containing WixUIBannerBmp and WixUIDialogBmp. Remember that when you
>>> reference anything inside a Fragment you get everything in that
> Fragment.
>>> So if I don't have anything I can reference, then I create an
>>> arbitrary Property used just for referencing.
>>>
>>> <Fragment>
>>>     <!-- Contains other stuff like WixUIBannerBmp and/or
>>> WixUIDialogBmp
>>> -->
>>>     <Property Id="DoesNotMatterButWillShowUpInPropertyTable"
>>> Value="DoesNotMatter"/>
>>> </Fragment>
>>>
>>> Then in another <Fragment> or <Product> I simply reference the
> Property:
>>>
>>> <Product ...>
>>>     <!-- other stuff that goes in Product -->
>>>     <PropertyRef Id="DoesNotMatterButWillShowUpInPropertyTable"/>
>>> </Product>
>>>
>>> I choose an Id that has some meaning for me but isn't too esoteric. I
>>> usually just set Value="1".
>>>
>>> --
>>> Edwin G. Castro
>>>
>>>
>>> On Wed, Jan 31, 2018 at 9:50 AM, Ven H <venh.123 at gmail.com> wrote:
>>>
>>> > Thanks a lot, Edwin. Sorry for being a bit naive here, but can you
>>> > please provide a code sample?
>>> >
>>> > Regards,
>>> > Venkatesh
>>> >
>>> > On Wed, Jan 31, 2018 at 11:15 PM, Edwin Castro <egcastr at gmail.com>
>>> wrote:
>>> >
>>> >> Yes. You just need to be able to reference something in the
>>> >> Fragment(s) that contain WixUIBannerBmp, WixUIDialogBmp. Perhaps
> UIRef?
>>> >>
>>> >> Sometimes I create Properties that I don't actually use for
>>> >> anything other than to reference them from another Fragment with
> PropertyRef.
>>> >>
>>> >> I kind of wish there was a way to reference a Fragment directly
>>> >> for situations where I don't have something I can reference in the
>>> Fragment...
>>> >>
>>> >> --
>>> >> Edwin G. Castro
>>> >>
>>> >>
>>> >> On Wed, Jan 31, 2018 at 9:32 AM, Ven H via wix-users <
>>> >> wix-users at lists.wixtoolset.org> wrote:
>>> >>
>>> >>> Is it possible to have wix variables like WixUIBannerBmp,
>>> >>> WixUIDialogBmp in a separate wxs file, rather than Product.wxs?
>>> >>> If yes, please explain how.
>>> >>> Since the values of these variables are paths, I cannot have them
>>> >>> as properties and I don't want to use preprocessor variables.
>>> >>> Please
>>> help.
>>> >>>
>>> >>>
>>> >>> Regards,
>>> >>> Venkatesh
>>>
>>
>>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> 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