WiX:CopyFile 属性 [英] WiX: CopyFile attributes

查看:23
本文介绍了WiX:CopyFile 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装时,我想选择性地将一些 .ini 文件从 SOURCEDIR 复制到 TARGETDIR,这意味着从 .msi 文件所在的目录到应用程序设置到的目标文件夹.

On install I want to optionally copy some .ini files from SOURCEDIR to TARGETDIR which means from the directory the .msi file is located to the destination folder the app is setup to.

我做了 <CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini" Delete="no"/> 但似乎不是做任何事情.日志文件没有多大帮助.

I did <CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini" Delete="no" /> but it seems it's not doing anything. The log file is not helping much.

我已经成功地使用 CopyFile 制作了一个更复杂的场景,但我对这个简单的场景感到困惑.

I've been successful in doing a much more elaborate scenario with CopyFile and I'm baffeled by this simple one.

我在 MoveFile 表中有这些行:

I have these rows in MoveFile table:

|FileKey     |Component     |SourceName          |SourceFolder|DestFolder|Options
|CopyIniFile |CoAppLicAndIni|Dreem15.ini         |SOURCEDIR   |INSTALLDIR|0
|MoveDataFile|CoAppLicAndIni|Dreem10_Personal.mdf|DB_DIR10    |INSTALLDIR|0

第二个正在工作.DB_DIR10 像这样在注册表中搜索<​​br>

and the second one is working. DB_DIR10 is searched in registry like this

<Property Id="DB_DIR10">
    <RegistrySearch Id='DbDirSearch10' Type='raw' Root='HKLM' Key='Software\$(var.CompanyName)\$(var.MsdeInstance)' Name='Dreem10_Personal' />
</Property>

推荐答案

根据 sourcedir 属性,指向包含源cabinet文件或安装包源文件树的根目录".

According to the windows installer documentation for the sourcedir property, it points to "the root directory that contains the source cabinet file or the source file tree of the installation package".

因此,要么您不知道 SourceDir 是预定义的 Windows 安装程序属性,要么您正试图从包含 msi 的安装介质中复制未打包的文件.在后一种情况下,像安装普通组件一样安装文件可能更有意义,以便正确卸载.

So either you were not aware that SourceDir is a predefined windows installer property, or you are trying to copy an unpackaged file from the installation medium that contains the msi. In the latter case it would probably make more sense to install the file like a normal component so that it will be properly uninstalled.

我已经测试了从安装介质复制"方案,它对我有用.另外,我已经安装了

I've tested the "copy from install medium" scenario and it worked for me. Also, I've installed with

misexec /lvx* install.log /i mymsi.msi

并且日志确实显示了正在复制的文件.日志在您的案例中说明了什么?

and the log did show the file being copied. What does the log say in your case?

Edit2:虽然 CopyFile 对我有用,但更好的解决方案是将未压缩的媒体添加到您的 wxs 中,如下所示:

While CopyFile worked for me, a better solution is to add an uncompressed medium to your wxs like this:

<Media Id='2'/>

然后为您的可自定义配置文件调整 File 元素,如下所示:

And then adapt the File element for your customizable config file like this:

<File Source='path\to\default\config.ini' Compressed='no' DiskId='2' />

这将使安装程序在与 msi 相同的文件夹中查找 config.ini,结合可定制性和干净卸载的优点.

This will make the installer look for config.ini in the same folder as the msi, combining the advantages of customizability and a clean uninstall.

这篇关于WiX:CopyFile 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆