简体   繁体   中英

Using a WiX property from a browse dialog

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.

This is my code:

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" />

Installation.wxs

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

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

Example

<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"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM