Is it possible to pass variable to WIX localization file?

前端 未结 3 2070
暖寄归人
暖寄归人 2021-01-04 03:59

I need to use variable in WIX localization file WIXUI_en-us.wxl. I tried use it like this:



        
3条回答
  •  醉话见心
    2021-01-04 04:05

    I was trying to get localization file to use variables. Came across this post:

    There are different layers of variables in WiX (candle's preprocessor variables, Light's WixVariables/localization variables/binder variables, and MSI's properties). Each have different syntax and are evaluated at different times:

    Candle's preprocessor variables "$(var.VariableName)" are evaluated when candle runs, and can be set from candle's commandline and from "" statements. Buildtime environment properties as well as custom variables can also be accessed similarly (changing the "var." prefix with other values).

    Light's variables accessible from the command-line are the WixVariables, and accessing them is via the "!(wix.VariableName)" syntax. To access your variable from your commandline, you would need to change your String to: This build was prepared on !(wix.BuildMachine)

    If you instead need to have the BuildMachine value exist as an MSI property at installation time (which is the "[VariableName]" syntax) you would need to add the following to one of your wxs files in a fragment that is already linked in:

    Now, the environment variable COMPUTERNAME always has held the name of my build machines in the past, and you can access that this way: $(env.COMPUTERNAME). So, you can get rid of the commandline addition to light.exe and change your wxs file like this:

提交回复
热议问题