35

我的要求是在programdata/test/example创建一个目录。我怎么能在wix中做到这一点?

4

3 回答 3

71

像这样定义文件夹:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="CommonAppDataFolder">
        <Directory Id="TestFolder" Name="test">
            <Directory Id="ExampleFolder" Name="example" />
        </Directory>
    </Directory>
</Directory>

这里重要的部分是CommonAppDataFolderWindows 安装程序知道的 Id。您可以在Windows Installer 属性参考中找到已知系统文件夹的完整列表。

如果您将任何文件安装到该文件夹​​,它将被隐式创建。如果没有,您可以通过安装这样的组件来强制创建它:

<Component Id="CreateTestFolder" Directory="ExampleFolder" Guid="PUT-RANDOM-GUID-HERE">
    <CreateFolder />
</Component>
于 2012-06-02T13:13:41.037 回答
15

Under <Product> you can enter:

   <DirectoryRef Id="TARGETDIR">
      <Directory Id="CommonAppDataFolder">
        <Directory Id="CommonAppXXXX" Name="test">
          <Directory Id="CommonAppYYYY" Name="example">
            <Component Id="CreateProgramDataZZZ" Guid="ABC-ETC">
              <CreateFolder />
            </Component>
          </Directory>
        </Directory>
      </Directory>
    </DirectoryRef>

And reference the component CreateProgramDataZZZ in your feature.

It can also be helpful to set permissions on the directory like this:

<CreateFolder>
    <util:PermissionEx User="Users" GenericAll="yes" />
</CreateFolder>

(in place of <CreateFolder />)

于 2014-08-18T13:14:30.127 回答
0

这将为您创建文件夹...

<Directory Id="DIR_ID" Name="DIR_NAME">
    <Component Guid="GUID" Id="id" KeyPath="no" NeverOverwrite="no" Permanent="no" Location="local">
        <CreateFolder>
            <util:PermissionEx CreateChild="yes" CreateFile="yes" Delete="yes" Read="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" ReadPermission="yes" Traverse="yes" GenericRead="yes" GenericWrite="yes" User="Everyone" />
        </CreateFolder>
    </Component>
</Directory>
于 2019-02-25T09:36:14.770 回答