WIX 工具集如何设置属性 [英] WIX Toolset How to Set a Property

查看:32
本文介绍了WIX 工具集如何设置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎应该是直观的,但到目前为止它还不是.当我的自定义对话框首次打开时,如何简单地设置我在 product.wxs 中定义的属性?

This seems like it should be intuitive, but so far its been anything but. How do I simply set a property I have defined in my product.wxs when my custom dialog first opens?

我的属性称为端口",初始化为空白.我有另一个名为df_Port",我将其设置为8080".(这些在我的 Product.wxs 中设置)当我的自定义对话框打开时,我想将端口"设置为df_Port".我在对话框上还有一个编辑控件,其属性"设置设置为端口".所以显然用户应该能够更新端口,但是如果他们点击返回"按钮,但最终回到这个对话框,编辑控件的默认值应该回到8080"

My Property is called "Port" which is initialized as blank. I have another called "df_Port", which I set to "8080". (These are set in my Product.wxs) When my Custom Dialog opens I want to set "Port" to "df_Port". I also have an Edit control on the dialog whose "Property" setting is set to "Port". So obviously the User should be able to update Port, but if they hit the "Back" button, but eventually come back to this dialog, the default value of the Edit Control should go back to "8080"

我尝试过 SetProperty,但它需要一个 Before 或 After 属性,我对此一无所知.我也尝试过创建一个 CustomAction,但这也没有奏效:

I have tried SetProperty, but it requires a Before or After property, and I have no clue on this. I have also tried to create a CustomAction, but this hasn't worked either:

<CustomAction Id="caPort" Property="Port" Value="[df_Port]"/>

控件显示为空白,而不是8080"

The control shows as blank, instead of "8080"

我使用的是 Wix 3.9 R2

I am using Wix 3.9 R2

推荐答案

没有人回答或评论我的问题.然而,经过多次试验和错误,我想出了一个解决方案.我想我会把它放在这里以防其他人遇到同样的问题.

Nobody answered or commented on my question. However, after much trial and error I figured out a solution. I figured I'd put it up here in case somebody else had the same problem.

1) 首先,我必须将属性命名为全部大写.所以在我的 product.wxs 中我声明:

1) First, I have to name properties as all Uppercase. So in my product.wxs I declare:

<Property Id="DF_PORT" Value="8080" Secure="yes"/>
<Property Id="PORT" Secure="yes"/>

2) 然后我添加一个发布标签并附加到我的自定义配置对话框之前的对话框的下一步按钮:

2) I then add a publish tag and attach to Next button of dialog preceding my custom configuration dialog:

<Publish Dialog="PrecedingDialogName" Control="Next" Property="PORT" Value="[DF_PORT]">1</Publish>

3) 在我的自定义对话框中,我只是将一个编辑控件绑定到 PORT 属性:

3) In my custom dialog, I just bind an Edit control to the PORT property:

<Control Id="Port" Type="Edit" X="130" Y="88" Width="60" Height="16" Property="PORT" Text="{WixUI_Font_Normal}" Integer="yes" RightAligned="yes" />

控件将显示默认值.如果我编辑了值,然后点击了返回"按钮,第 2 步将重新加载默认值,而不是记住用户输入的内容.

The control will display the default value. If I edit the value, but then hit the "Back" button, Step 2 will reload the default value, instead of remembering what the User had typed.

在使用 WIX 工具集几周后,老实说,这是我见过的最糟糕、最不直观的开发作品之一!

After working with WIX Toolset for a couple of weeks now, I can honestly say that this is one of the worst and most unintuitive development pieces I have ever seen!

这篇关于WIX 工具集如何设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆