【问题标题】:WIX 3.8 installer: Add files to a pre-existing folderWIX 3.8 安装程序:将文件添加到预先存在的文件夹
【发布时间】:2014-01-09 06:05:20
【问题描述】:

如何将文件直接安装到用户计算机上预先存在的文件夹中?我阅读的所有文档都只解释了创建自定义 INSTALLDIR。

例如。 c:\ProgramFiles(x86)\ExampleFolderA\ExampleFolderB\InstalledFile.exe

【问题讨论】:

    标签: wix


    【解决方案1】:

    你应该先定义目录结构:

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="ExampleFolderAId" Name="ExampleFolderA">
          <Directory Id="ExampleFolderBId" Name="ExampleFolderB" />
        </Directory>
      </Directory>
    </Directory>
    

    请注意,上面的定义在安装运行时不会创建目录。为了真正“创建”目录,您必须在其中放置文件(使用Component 元素),或者明确声明该目录为空。

    类似这样的:

    <DirectoryRef Id="ExampleFolderAId">
      <Component Id="SampleComponent" Guid="GUID-GOES-HERE">
        <File Id="SampleFile" Source="C:\readme.txt" KeyPath="yes" />
      </Component>
    </DirectoryRef>
    

    或

    <DirectoryRef Id="ExampleFolderBId">
      <Component Id="EmptyFolderComponent" Guid="GUID-GOES-HERE">
        <CreateFolder />
      </Component>
    </DirectoryRef>
    

    希望你能明白。

    【讨论】:

      猜你喜欢
      • 2012-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 2017-10-06
      • 1970-01-01
      相关资源
      最近更新 更多