在 WiX 文件中,Name="SourceDir" 是什么?参考? [英] In WiX files, what does Name="SourceDir" refer to?

查看:22
本文介绍了在 WiX 文件中,Name="SourceDir" 是什么?参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WiX 文件似乎总是包含这一行:

WiX files always seem to include this line:

<Directory Id="TARGETDIR" Name="SourceDir">

什么是SourceDir"?这有什么用途?这不是一个真正的目录名称.是某种神奇的价值吗?

What is "SourceDir"? What is it used for? It's not a real directory name. Is it some kind of magical value?

推荐答案

来自:http://robmensching.com/blog/posts/2010/1/26/StackOverflow-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.

这篇关于在 WiX 文件中,Name="SourceDir" 是什么?参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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