Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if VSTO 2010 Runtime is Installed?

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.

like image 470
joelsand Avatar asked May 10 '10 01:05

joelsand


1 Answers

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:

  • HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4 (32-bit, VSTO installed from Office 2010 installation)
  • HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4R (32-bit, VSTO installed from redistributable)
  • HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4 (64-bit, VSTO installed from Office 2010 installation)
  • HKLM\SOFTWARE\Wow6432Node\Microsoft\VSTO Runtime Setup\v4R (64-bit, VSTO installed from redistributable)

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:

The Visual Studio 2010 Tools for Office runtime also ships with Microsoft Office 2010. However at the time of Office 2010 RTM, the runtime with Office only supports Office solutions that target the .NET Framework 3.5. If your solution targets the .NET Framework 3.5, it can run either if Office 2010 is installed or if the Visual Studio 2010 Tools for Office Runtime redistributable is installed. If your Office solutions target the .NET Framework 4, you must redistribute the Visual Studio 2010 Tools for Office runtime (citation).

like image 200
Gavin Avatar answered Nov 16 '22 02:11

Gavin