如何确定是否安装了 VSTO 2010 Runtime?
只需使用产品代码 {388E4B09-3E71-4649-8921-F44A3A2954A7} 调用 MsiGetProductInfo() 即可轻松检查是否安装了 VSTO 2005 SE,如 MSDN 中列出。
VSTO 2010/4.0 运行时的产品代码是什么?或者有没有更好的方法来确定它是否已经安装?这是我们的安装过程。
另外,我试图找出相同的 Windows 映像组件。
It was easy to check if VSTO 2005 SE was installed by just calling MsiGetProductInfo() with the product code {388E4B09-3E71-4649-8921-F44A3A2954A7}, as listed in MSDN.
What is the product code for the VSTO 2010/4.0 runtime? Or is there a better way to determine if it's already installed? This is for our installation process.
Also, I am trying to figure out the same for Windows Imaging Component.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
不幸的是,到目前为止,这里的答案并没有完全涵盖所有基础。
产品代码
这似乎并不可靠 - 我们正在寻找最低版本,而不是特定版本。虽然理论上产品代码应该只针对主要版本增量进行更改,但我的计算机上的 VSTO 版本 - 10.0.40303 - 的产品代码为 {A0FE0292-D3BE-3447-80F2-72E032A54875}。这表明微软不一定能让它们保持稳定,所以我建议这不是一个好的选择。
文件版本
另一种选择可能是检查 VSTO 程序集本身是否存在/版本,通常位于 %PROGRAM FILES%\Common Files\Microsoft Shared\VSTO\10.0 中。不过我想说这个目录是不能保证的 - 实际目录似乎是在注册表中指定的,但显然这个解决方案现在并不比直接从注册表中获取版本更好......
注册表
因此,通过注册表可能是唯一的选择。
遗憾的是,VSTO 运行时版本可能出现在 4 个注册表位置中的任意一个中:
注意:我没有明确的来源 - 我我正在拼凑一些信息,例如 Wouter van Vugt 的这篇博文 和这个答案。可能还有更多的事情要做。
此外,可能还有最低版本要求,但我怀疑实际上这只会影响运行 Office 2010 预发行版本的用户:
Unfortunately the answers here so far do not quite cover all the bases.
Product Code
This does not appear to be reliable - we're looking for a minimum version, not a specific version. Though the product code is in theory only supposed to change for major version increments, the version of VSTO on my machine - 10.0.40303 - has a product code of {A0FE0292-D3BE-3447-80F2-72E032A54875}. This suggests that Microsoft isn't necessarily keeping them stable, so I'd suggest this is not a good option.
File version
Another option may be to check for the presence / version of the VSTO assemblies themselves, which may typically be in %PROGRAM FILES%\Common Files\Microsoft Shared\VSTO\10.0. However I'd say this directory is not guaranteed - the actual directory appears to be specified in the registry, but obviously this solution is now no better than just getting the version from the registry directly...
Registry
So going by the registry is probably the only option left.
Unfortunately, the VSTO runtime version can appear in any one of 4 registry locations:
Note: I don't have a definitive source for this - I'm cobbling together bits of information from, for example, this blog post by Wouter van Vugt and this SO answer. There may be even more to it than that.
In addition, there may be minimum version requirements, though I suspect that in practice this is only going to affect people running pre-release versions of Office 2010:
最简单的方法是检查注册表。
HKLM\Microsoft\vsto 运行时设置\v4\Install
HKLM\Microsoft\vsto 运行时设置\v4R\VSTORFeature_CLR40(适用于 4.0 Office 扩展)
The easiest way is to check the registry.
HKLM\Microsoft\vsto runtime setup\v4\Install
HKLM\Microsoft\vsto runtime setup\v4R\VSTORFeature_CLR40 (this is for the 4.0 Office extensions)
最安全、最干净的方法仍然是检查产品代码,如下:
对于 VSTO 2010 x86,版本 10.0.31124: {41A01180-D9FD-3428-9FD6-749F4C637CBF}
对于 VSTO 2010 x64,版本10.0.31124:{C3600AE6-93A0-3DB7-B7AA-45BD58F133B5}
我通过使用 7-Zip 提取以下包的内容并使用 Orca 分析 MSI 来获取它们:
http://download.microsoft.com/download/F /3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x86.exe
http://download.microsoft.com/download/F/3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x64.exe
The safest and cleanest method is still checking the product codes, here they are:
For VSTO 2010 x86, version 10.0.31124: {41A01180-D9FD-3428-9FD6-749F4C637CBF}
For VSTO 2010 x64, version 10.0.31124: {C3600AE6-93A0-3DB7-B7AA-45BD58F133B5}
I got them by extraction the contents of the following packages with 7-Zip and analyzing the MSIs with Orca:
http://download.microsoft.com/download/F/3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x86.exe
http://download.microsoft.com/download/F/3/9/F395E3C2-28A0-4F0D-9E20-FF4D1ADB08D8/vstor40_x64.exe
它们的密钥因您要安装的操作系统而异。我煞费苦心地在 x86 和 x64 中安装了独立的 vsto 和 Office 2010 和 2013 .exe。
为了使用注册表检查是否安装了 vsto,您需要验证以下项是否存在:
编辑:我实际上最终做的是验证
v4
文件夹是否存在。They keys vary by the OS you are installing to. I painstakingly installed the standalone vsto and office 2010 and 2013 .exe's in x86 and x64.
In order to use the registry to check if vsto is installed, you need to verify the existence of the following keys:
Edit: What I actually ended up doing, was verify that the
v4
folder exists.在 SCCM 2012 中将 Vstor 部署为应用程序时,我需要一种方法来检测这一点。我使用以下 PowerShell 脚本从 WMI 检索信息。
如果版本为 10.0.50908,则会生成输出。如果检测脚本返回任何值,SCCM 就会认为检测成功。
I needed a way of detecting this when deploying Vstor as an application in SCCM 2012. I used the following PowerShell script to retrieve the info from WMI.
If the version is 10.0.50908, output is generated. SCCM considers detection to be successful if the detection script returns any value.
这里是代码。
在公共方法中,我们确定 VSTO 是从 Office 还是 VSTO 运行时包安装的。
在私有方法中,检查版本是否等于或大于版本VSTO2010
Here code.
In public method we determine is VSTO installed from Office or VSTO runtime package.
In private method, check if version is equals or bigger than version VSTO2010