WIX:将文件复制到另一个分区中的自定义目录 [英] WIX: copy file to custom dir in another partition
问题描述
我需要将我的应用程序文件安装到通常的位置,例如 C:\Program Files\MyApp
并且还需要将其中的几个复制到另一个分区的自定义文件夹中
(假设 D:\CustomFolder
,允许对其进行硬编码).
安装应该是静默的 - 没有 gui 或向导.并且所有内容都应该在一个 *.msi 文件中.
我可以通过 CustomActions
做到这一点,但更可取的是优雅的声明方式.
以前有人试过吗?
谢谢.
更新:忘了说,应该在单独分区上的文件允许在 C:\Program Files\MyApp
已解决.方法是:
指定放置文件的自定义文件夹:
将
指令放入应该复制的
<块引用>
<Component Id="MyComponent" Guid="some_guid"><File Id="MyFileXml" Source="MyFile.xml" KeyPath="yes" ><CopyFile Id="Copy_MyFileXml" DestinationProperty="MY_CUSTOM_DESTINATION"/></文件></组件></DirectoryRef>
附言作为副作用,在 <File Id="MyFileXml" .../>
中指定的文件将被放入两个位置:C:\Program Files\MyApp
和 D:\MyCustomFolder
,但这对我的任务来说是正确的.
I need to install my app's files to usual location like C:\Program Files\MyApp
and also need to copy several of them into custom folder in another partition
(let's say D:\CustomFolder
, it's allowed to hardcode it).
Install should be silent - no gui or wizard. And alose everything should be in one *.msi file.
I can do that via CustomActions
, but elegant-declarative way is preferable.
Has anyone tried this before?
Thanks.
UPDATE:
Forgot to mention, that it's allowed for files that should be on separate partition to be in C:\Program Files\MyApp
Solved. The approach is:
Specify custom folder where file should be put:
<Property Id="MY_CUSTOM_DESTINATION" Value="D:\MyCustomFolder" />
Put
<Copy ..>
directive into<File ...>
which should be copied
<DirectoryRef Id="MyAppFolderThatIsInProgramFiles"> <Component Id="MyComponent" Guid="some_guid"> <File Id="MyFileXml" Source="MyFile.xml" KeyPath="yes" > <CopyFile Id="Copy_MyFileXml" DestinationProperty="MY_CUSTOM_DESTINATION"/> </File> </Component> </DirectoryRef>
p.s. as a side-effect, file specified in <File Id="MyFileXml" ... />
will be put into both location: C:\Program Files\MyApp
and D:\MyCustomFolder
, but that's correct for my task.
这篇关于WIX:将文件复制到另一个分区中的自定义目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!