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

查看:35
本文介绍了在 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天全站免登陆