2011-08-19 47 views
0

我正在使用WiX开发安装项目,并且遇到以下问题。我从使用浏览对话框的用户那里得到一个目录路径,我需要把这个路径放在web.config。问题在于web.config将值放在“WWWMain”中,而不是用户选择的路径。从浏览对话框中使用WiX属性

这是我的代码:

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]"/> 
+0

问题是概念上的,从而使该路径将被正确保存在web.config中,因为该值必须放在[WWWMain] – camaya

回答

1

声明变量在Dialog.wxs本身,而是控制后

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

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

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