2012-12-25 26 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中。我试图将目录名称设置为用户给出的属性。

到目前为止,我所看到的解决此问题的关键方法是使用自定义操作将目录数据表更改为您要另外引用的属性的值。只要确保您定制自定义操作的时间,以使其在目录正常设置之前不会发生,否则可能会被覆盖。

但是我仍然在寻找一些更漂亮的东西。