使用浏览对话框中的 WiX 属性 [英] Using a WiX property from a browse dialog

查看:17
本文介绍了使用浏览对话框中的 WiX 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WiX 开发安装项目,但遇到以下问题.我使用浏览对话框从用户那里获得一个目录路径,我需要将此路径放在 web.config 中.问题是在 web.config 中将值放在WWWMain"而不是用户选择的路径中.

I'm developing a setup project using WiX, and I have the following problem. I get a directory path from the user using the Browse dialog, and I need to put this path in web.config. The problem is that in web.config that puts the value in "WWWMain" and not the path chosen by the user.

这是我的代码:

Product.wxs

<Property Id="IISLOGDIRECTORY" Value="WWWMain" />

Dialog.wxs

<Control Id="IISLogDirectoryEdit" Type="PathEdit" X="45" Y="100" Width="220" Height="18" Disabled="yes" Property="IISLOGDIRECTORY" Indirect="yes" />

安装.wxs

<util:XmlFile Id="ModifyIISLogDirectory"
           Action="setValue"
           Permanent="yes"
           ElementPath="/configuration/appSettings/add[\[]@key='isslogdirectory'[\]]/@value"
           File="[INSTALLLOCATION]Web\Web.config"
           Value="[IISLOGDIRECTORY]"/>

推荐答案

在 Dialog.wxs 本身声明变量,但在控件之后

Declare the variable in Dialog.wxs itself but after the control

示例

<Control Id="DiffBackUpEdit" Type="PathEdit" X="120"  Y="157" Width="160" Height="18" Property="IISLOGDIRECTORY">
</Control>
<Control Id="Browse12" Type="PushButton" X="290" Y="157" Width="56" Height="17" Text="Browse">
    <Publish Property="_BrowseProperty" Value="DIFFDBBACKUPLOC" Order="1">1</Publish>
    <Publish Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
</Control>

然后在添加后在同一页面的底部

Then at bottom in same page after add

<Property Id="IISLOGDIRECTORY" Value="C:\Database\MDM"/>

这篇关于使用浏览对话框中的 WiX 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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