2012-12-25 24 views
0

這隱含屬性是什麼,我試圖做一個例子:使用的目錄名

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> 
<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="MySoftware" UpgradeCode="d2192e52-f4f6-461c-9d8e-eb66067df09a"> 
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> 

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> 
    <MediaTemplate /> 

    <Feature Id="ProductFeature" Title="SetupProject1" Level="1"> 
     <ComponentGroupRef Id="ProductComponents" /> 
    </Feature> 
</Product> 

<Fragment> 
    <Directory Id="TARGETDIR" Name="SourceDir"> 
     <Directory Id="ProgramFilesFolder"> 
      <Directory Id="INSTALLFOLDER" Name="[Manufacturer] SetupProject1" /> 
     </Directory> 
    </Directory> 
</Fragment> 

<Fragment> 
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
     <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. --> 
     <!-- <Component Id="ProductComponent"> --> 
      <!-- TODO: Insert files, registry keys, and other resources here. --> 
     <!-- </Component> --> 
    <Component Id="CMP_NEW"> 
    <File Id="FILE_NEW" Source="New Text Document.txt" KeyPath="yes" /> 
    </Component> 
    </ComponentGroup> 
</Fragment> 

,在PROGRAMFILES創建的文件夾爲[生產企業] SetupProject1而不是MySoftware SetupProject1。我做對了嗎?如果沒有,我該怎麼做?

感謝先進!

回答

0

創建一個變量$(var.Manufacturer),並使用它像這樣:

定義是這樣的:<?define Manufacturer = "MySoftware"?>

<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="$(var.Manufacturer)" UpgradeCode="d2192e52-f4f6-461c-9d8e-eb66067df09a"> 

<Directory Id="INSTALLFOLDER" Name="$(var.Manufacturer) SetupProject1" /> 

,將工作.. :)

0

我的問題是不能將預處理器變量設置爲在安裝過程中定義的值,例如在UI中。我試圖將目錄名稱設置爲用戶給出的屬性。

到目前爲止,我所看到的解決此問題的關鍵方法是使用自定義操作將目錄數據表更改爲您要另外引用的屬性的值。只要確保您定製自定義操作的時間,以使其在目錄正常設置之前不會發生,否則可能會被覆蓋。

但是我仍然在尋找一些更漂亮的東西。