2011-08-19 35 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"/>