Windows Installer 将 ROOTDRIVE 评估为可用内存空间较少的本地驱动器 =>为什么? [英] Windows Installer evaluates ROOTDRIVE to local drive with less free memory space => why?

查看:31
本文介绍了Windows Installer 将 ROOTDRIVE 评估为可用内存空间较少的本地驱动器 =>为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

互联网上的许多页面和有关 Windows Installer 的书籍都引用了以下 Microsoft 页面 ROOTDRIVE 用于:

Lots of pages in the internet and books about Windows Installer are citing the following Microsoft page ROOTDRIVE for:

如果 ROOTDRIVE 未在命令行中设置或未编写到属性表中,则安装程序会设置此属性.在管理安装期间,安装程序将 ROOTDRIVE 设置为它发现可以写入的第一个连接的网络驱动器.如果不是管理安装,或者安装程序找不到网络驱动器,安装程序将 ROOTDRIVE 设置为可写入的本地驱动器,以拥有最大可用空间.

If ROOTDRIVE is not set at a command line or authored into the Property table, the installer sets this property. During an administrative installation the installer sets ROOTDRIVE to the first connected network drive it finds that can be written to. If it is not an administrative installation, or if the installer can find no network drives, the installer sets ROOTDRIVE to the local drive that can be written to having the most free space.

嗯,在我客户的机器上,C:Y: 有更多的可用空间,但应用程序被安装到 Y:\MyApp 而不是 C:\Program Files (x86)\MyApp.当然,WiX 和目录结构是标准样式的:

Well, on my customer's machine C: has lots of more free space than Y:, but the application gets installed into Y:\MyApp instead of C:\Program Files (x86)\MyApp. Of course the WiX and Directory structure are standard-style:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="ProgramFilesFolder">
    <Directory Id="INSTALLFOLDER" Name="$(var.CompanyName)">
      <Directory Id="MyAppFolder" Name="MyApp" />
    </Directory>
  </Directory>
</Directory>

所以没什么特别的.在其他机器上,它按预期安装到 Program Files 文件夹.

So nothing special. On other machines it installs to Program Files folder as expected.

根据我的日常经验,最大可用空间" 的规则是不正确的,因为在我处理的许多机器上,SSD 都相当小,如 C: 本地驱动器和更大的数据驱动器 D:C: 相比,其可用空间多 TB.如果该规则适用,那么现在大多数计算机会将(所有)应用程序安装到其数据驱动器根目录(例如 D:\),而不是在受特殊保护的 % 下ProgramFiles%/%ProgramFiles (x86)% 文件夹.在我所有配置小型 SSD 和大数据 HDD 的机器上,所有的东西都安装到我预期的 C: 中的 Program Files 文件夹中.所以最自由空间"的规则绝对不正确!!!并且 MSI 没有特别定义任何 TARGETDIRROOTDIR 属性到 C:\ 命令行上的 MSI 表在任何情况下!

From my daily experience the rule with the "most free space" cannot be true, since on lots of machines I am dealing with have a rather small SSD as C: local drive and a much, much more bigger data drive D: with Terabytes more free space than C:. If that rule would fit then nowadays most of the computers would have (all) their applications being installed to their Data Drive root directory (e.g. D:\) and not underneath the specially-protected %ProgramFiles%/%ProgramFiles (x86)% folders. On all my machines with the configuration small SSD vs. big data HDD with more space all the stuff gets installed into my expected Program Files folders in C:. So the rule of the "most free space" is definitely NOT TRUE!!! And the MSIs are not especially defining any TARGETDIR or ROOTDIR property to C:\ on command line neither MSI table in any case!

所以肯定有另一个评价规则.哪一个?谁能解释这种奇怪的行为?

So there must be another evalution rule. Which one is it? Who can explain the odd behaviour?

编辑

感谢 Stein,我仔细查看了日志,发现 ROOTDRIVE 实际上确实指向较大的本地磁盘,但由于 系统文件夹属性的优先级较高它总是安装在系统驱动器上的正确位置.我在提出问题时还查看了来自戴尔数据保护的日志文件,该文件明确必须将 ROOTDRIVE 设置为 C:\ 或系统驱动器.因此 MSDN 中的 ROOTDRIVE 规则似乎是正确的,但在大多数情况下它没有任何影响.

当我自己查看有问题的计算机时,我看到 Y: 是一个网络驱动器,然后我搜索了 ADMIN et voilà 这个词:这是一个管理安装,尽管我的客户告诉我他只是双击了 MSI 和 Y:是一个本地驱动 => 今年我对节日的不满将是人们不应该永远相信客户所说和誓言;-)

EDIT

Thanks to Stein I did a closer look at the logs and found out that ROOTDRIVE actually really points to the larger local disks but due to the higher priority of the System Folder Properties it always gets installed into the right place on System Drive. The log file I also looked into when asking the question was the one from Dell Data Protection which explicitly must have set ROOTDRIVE to C:\ or System Drive. Thus The ROOTDRIVE rule from MSDN seems to be true but it does not have any effect in most of the times.

When I looked on the problem computer myself I saw that Y: was a network drive, then I searched for the word ADMIN et voilà: it was an administrative installation although my customer told me that he just double-clicked on the MSI and Y: was a local drive => my airing grievance this year for the festivus will be that one should not never believe what the customer says and vows ;-)

推荐答案

系统文件夹属性:我想答案可以在这个赛门铁克文章.本质上:系统文件夹属性不受 ROOTDRIVE 属性的影响.

顺便说一下,我的 D:\ 驱动器比我的 C:\ 驱动器有更多空间,并且 ROOTDRIVE 设置为 D:\ 在 MSI 日志文件中.但是,安装不会将文件写入 D:\.我认为这是由于 C:\ 上有足够的空间?

Incidentally my D:\ drive has more space than my C:\ drive and ROOTDRIVE is set to D:\ in the MSI log file. Installation writes no files to D:\ though. I would think this is due to ample space on C:\?

更新:同时检查文档在 TARGETDIR 上,重点介绍此部分:

UPDATE: Also check the documentation on TARGETDIR, with focus on this section:

"...如果定义了 TARGETDIR 属性,则目标目录解析为该属性的值.如果 TARGETDIR 属性是未定义,ROOTDRIVE 属性用于解析路径."

<小时>

问题计算机:以上内容并没有真正解释您的问题计算机上会发生什么,是吗?您是否曾经手动安装到此自定义位置?您是否使用了 记住属性"模式 来保存安装文件夹?它一定是在回读那条旧路吗?或者磁盘空间非常低?或者您是使用管理映像进行安装?AdminProperties.那里没有设置属性自定义操作?GUI 中是否有可能影响这一点的构造?我知道在一些 WiX 的默认 GUI 集中使用了 set 属性.您可以将目录修改为功能目录".在此处查看页面下方的屏幕截图.


Problem Computer: The above does not really explain what happens on your problem computer, does it? Did you ever install manually to this custom location? Did you use a "Remember Property" pattern to persist the installation folder? It must be reading back that old path? Or maybe the disk is very low on space? Or are you installing using an admin image? AdminProperties. No Set Property custom actions in there? Could there be constructs in the GUI that could affect this? I know set property is used in some of WiX's default GUI sets. And you can make directories modifiable as "feature directories". See the screenshot down the page here.

详细日志:我建议您在安装程序转到辅助驱动器的系统上制作一个日志文件,并检查写入日志的内容ROOTDRIVE 和目录解析一般.在目标计算机统一的企业环境中,许多实际上将 ROOTDRIVE 硬编码到 C:\ - 不是很好,但确实如此.他们不会这样做,除非他们试图按照你所描述的方式避免一些随机的副作用.

Verbose Log: I would suggest you make a log file on a system where the installs go to a secondary drive and check what is written into the log with regards to ROOTDRIVE and directory resolution in general. In corporate environments where target computers are uniform many actually hard code ROOTDRIVE to C:\ - not great, but they do. They wouldn't do that unless they are trying to avoid some random side effect along the lines of what you describe.

节日申诉:我一直不喜欢这个 ROOTDRIVE 问题,老实说从来没有完全理解它.换句话说,我听到了你.这实际上是我对 MSI 的 Festivus 不满之一.我回答了吗?并不真地 :-).你至少有一些指示.或许 WiX 专家Chris PainterPhilDW 可以提供完整的答案.

Festivus Grievance: I have always disliked this ROOTDRIVE issue, and never fully understood it to be honest. I hear you in other words. It is in fact one of my Festivus grievances against MSI. Did I answer? Not really :-). You have some pointers at least. Maybe the WiX guys, Chris Painter or PhilDW can provide a complete answer.

不要使用以下结构:

<!--ROOTDRIVE explicitly set to prevent it from defaulting to drive with most space-->
<Property Id="ROOTDRIVE" Value="$(env.SystemDrive)" />

<!-- NO SOLUTION -->

以上将是编译时解析,而不是文件夹的运行时解析.换句话说,它根本不是解决方案.ROOTDRIVE 将设置为构建计算机的系统驱动器盘符,而不是您安装到的计算机的系统盘符.

The above will be a compile time resolution, and not a runtime resolution of the folder. In other words it is no solution at all. ROOTDRIVE will be set to the system drive letter of the build computer, not of the computer you install to.

构建您可以尝试强制将 ROOTDRIVE 设置为系统驱动器:

<CustomAction Id='SetRootDrive' Property='ROOTDRIVE' Value='[%SystemDrive]\' />

<InstallUISequence>
  <Custom Action="SetRootDrive" Before="CostInitialize"></Custom>
</InstallUISequence>

<小时>

一些链接:

这篇关于Windows Installer 将 ROOTDRIVE 评估为可用内存空间较少的本地驱动器 =>为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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