【发布时间】:2014-01-09 06:05:20
【问题描述】:
如何将文件直接安装到用户计算机上预先存在的文件夹中?我阅读的所有文档都只解释了创建自定义 INSTALLDIR。
例如。 c:\ProgramFiles(x86)\ExampleFolderA\ExampleFolderB\InstalledFile.exe
【问题讨论】:
标签: wix
如何将文件直接安装到用户计算机上预先存在的文件夹中?我阅读的所有文档都只解释了创建自定义 INSTALLDIR。
例如。 c:\ProgramFiles(x86)\ExampleFolderA\ExampleFolderB\InstalledFile.exe
【问题讨论】:
标签: wix
你应该先定义目录结构:
<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>
希望你能明白。
【讨论】: