gpt4 book ai didi

reference - WiX 属性引用另一个属性

转载 作者:行者123 更新时间:2023-12-04 01:02:58 30 4
gpt4 key购买 nike

我正在尝试为我的应用程序创建多个快捷方式,使用 Arguments 在命令行上传递不同的参数。 Shortcut 的属性元素。我希望能够从我的 中的另一个属性中引用现有属性WiX 文件。

我希望能够通过引用 ARGUMENTS 创建快捷方式属性(property)通过:

<Component Id="MyAppProgramMenuShortcut" Guid="MY-GUID-HERE">
<RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]\MyAppShortcut" Type="string"
Value="" KeyPath="yes" />
<Shortcut Id="ProgramMenuShortcutMyApp" Directory="ProgramMenuDir"
Name="MyApp" Target="[SHORTCUT_TARGET]"
Arguments="-jar myApp.jar [ARGUMENTS]" WorkingDirectory="INSTALLDIR"
Icon="logo.ico" />
</Component>

我试过一些相当于:
<Property Id="PROGRAM_FILES">C:\Program Files</Property>
<Property Id="MY_APP_DIR">[PROGRAM_FILES]\MyApp</Property>
<Property Id="ARGUMENTS">[MY_APP_DIR]\fileA.xml [MY_APP_DIR]\fileB.xml</Property>

但是当我通过candle.exe传递它时我收到了这个警告:

warning CNDL1077 : The 'MY_APP_DIR' Property contains '[PROGRAM_FILES]' in its value which is an illegal reference to another property. If this value is a string literal, not a property reference, please ignore this warning. To set a property with the value of another property, use a CustomAction with Property and Value attributes.



因此,根据警告中的建议,我切换到了相当于:
<CustomAction Id="PROGRAM_FILES" Property="PROGRAM_FILES" Value="C:\Program Files"/>
<CustomAction Id="MY_APP_DIR" Property="MY_APP_DIR" Value="[PROGRAM_FILES]\MyApp"/>
<CustomAction Id="ARGUMENTS" Property="ARGUMENTS" Value="[MY_APP_DIR]\fileA.xml [MY_APP_DIR]\fileB.xml"/>

我没有收到警告或错误,但问题是当我安装应用程序时,快捷方式在目标字段中没有参数。

我不是在做我应该做的事情吗?有没有办法做我想做的事?

最佳答案

您不需要 Program Files 或产品安装目录的属性。使用 [#FileId]引用该文件的完整路径。

另外,如果您想要多个快捷方式,只需设置多个 Shortcut不同的元素 Arguments属性。如果您想要多个快捷方式之一,您可以有多个 Component s 与 Shortcut s 并使用 Condition只安装其中之一。

关于reference - WiX 属性引用另一个属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7179578/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com