且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 WiX 文件中,Name="SourceDir" 是什么?参考?

更新时间:2023-01-24 13:20:13

来自:http://robmensching.com/blog/posts/2010/1/26/***-what-does-NameSourceDir-refer-to

老实说,这是我们应该对开发人员隐藏的东西,但没有.对不起.事情的真相是,Windows 安装程序希望目录树始终植根于目录行,其中主键 (Directory/@Id) 是TARGETDIR",DefaultDir 列 (Directory/@Name) 是SourceDir".

Honestly, it's something that we should have hidden from the developer but didn't. Sorry. The truth of the matter is that the Windows Installer expects the Directory tree to always be rooted in a Directory row where the primary key (Directory/@Id) is "TARGETDIR" and the DefaultDir column (Directory/@Name) is "SourceDir".

在安装过程中,TARGETDIR 将默认为机器上最大的驱动器.SourceDir 将设置为 MSI 所在的位置正在执行.现在,SourceDir 在初始安装后很棘手,因为除非调用 ResolveSource 操作,否则不会设置它.但是,您不想显式调用 ResolveSource 操作,因为它可能会提示您提供原始源媒体(又名:请插入 CD).

During an install, TARGETDIR will default to the largest drive on the machine. SourceDir will be set to the location where the MSI is being executed. Now, SourceDir is tricky after the initial install because it won't be set unless the ResolveSource action is called. However, you don't want to explicitly call the ResolveSource action because it is likely to prompt you to provide the original source media (aka: insert the CD, please).

我们应该在 WiX 工具集中做的是消除指定 TARGETDIR/SourceDir 对的需要,并说任何没有父级的目录元素都将自动成为 TARGETDIR 的父级,因为这是 MSI SDK 所说的."相反,你必须自己做......有些开发者想知道这一切意味着什么.

What we should have done in the WiX toolset is remove the need to specify the TARGETDIR/SourceDir pair and say "Any Directory element that has no parent will automatically be parented to TARGETDIR because that's what the MSI SDK says to do." Instead, you have to do it yourself... and some devs wonder what it all means.