WIX Toolset How to Set a Property(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 工具集如何设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:WIX 工具集如何设置属性
基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01