在 Windows 2012 R2 上运行时,如何让 MSI 返回正确的 VersionNT 值? [英] How do I get MSI to return the correct VersionNT value when running on Windows 2012 R2?
问题描述
当我在 Windows 2012 R2 机器(RTM 版本 9600)上运行我的 MSI 时,VersionNT 属性设置为 602(而不是 603).如果 602 实际上是正确的操作系统版本,那么如何在安装时以编程方式区分 Windows 2012 和 Windows 2012 R2?
When I run my MSI on a Windows 2012 R2 machine (RTM build 9600) the VersionNT property is set to 602 (instead of 603). If 602 is actually the correct OS version, then how to I programmatically differentiate between Windows 2012 and Windows 2012 R2 at install time?
更新:看起来如果我直接在 Windows 2012 R2 或 Windows 8.1 上运行我的 MSI,VersionNT 将正确设置为 603.如果我的 MSI 被引导程序(一个 win32 应用程序)启动,VersionNT 将被错误地设置为 602.因此,直接运行的 MSI 与由 win32 应用启动的 MSI 之间存在差异.
Update: It looks as though if I run my MSI directly on Windows 2012 R2 or Windows 8.1, VersionNT will be, correctly, set to 603. If my MSI is kicked off by a bootstrapper (a win32 app), VersionNT will be set, incorrectly, to 602. So, there's a discrepancy between an MSI being run directly vs. being launched by a win32 app.
Windows 10 更新:
我发现当我更新引导程序的清单以支持 Windows 10 兼容性时,MSI 的 InstallUISequence 将正确设置 VersionNT=1000,但 InstallExecuteSequence 将具有 VersionNT=603.
Windows 10 Update:
I'm finding that when I update the manifest for my bootstrapper to support Windows 10 compatability, the InstallUISequence of the MSI will correctly set VersionNT=1000, but the InstallExecuteSequence will have VersionNT=603.
如何让 InstallExecuteSequence 也设置 VersionNT=1000?
How do I make the InstallExecuteSequence also set VersionNT=1000?
推荐答案
您的引导程序需要清单以明确支持 Win8/2012R3.这将很快在 Burn 中的 WiX 3.8 中修复,但您可以按照此处记录的方式显示任何引导程序:http://msdn.microsoft.com/en-us/library/aa374191%28v=vs.85%29.aspx.
Your bootstrapper needs to be manifest to explicit support Win8/2012R3. This will be fixed in WiX 3.8 soon in Burn, but you can manifest any bootstrapper as documented here: http://msdn.microsoft.com/en-us/library/aa374191%28v=vs.85%29.aspx.
具体来说,您需要为 Windows 8 和 Windows 8.1 添加 GUID:
Specifically, you need to add the GUIDs for Windows 8 and Windows 8.1:
{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}
{1f676c76-80e1-4239-95bb-83d0f6d0da78}
如果您可以访问引导程序的源代码,更好的、面向未来的方法是调用 RtlGetVersion
,如下所述:http://msdn.microsoft.com/en-us/library/windows/hardware/ff561910(v=vs.85).aspx.这是我在外部推动 Burn 的更改(我们在内部将其用于 Visual Studio).
If you have access to the source code for the bootstrapper, the better, future-proof way is to call RtlGetVersion
as documented here: http://msdn.microsoft.com/en-us/library/windows/hardware/ff561910(v=vs.85).aspx. This is the change I'm pushing to Burn externally (we use this internally for Visual Studio).
这篇关于在 Windows 2012 R2 上运行时,如何让 MSI 返回正确的 VersionNT 值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!