Reputation: 15718
Consider the following scenario--
Let's assume you are writing an application that needs to use a specific Windows application. Specifically, it's an application that installs various API tools intended to provide application integration into some other Microsoft software or service.
Now, let's make a couple of other assumptions, which are as follows:
Using C#, is there a standardized way of checking to see if an application has been installed. Specifically, is there some WMI call or registry query that when executed returns some form of unique identifier that is intended to represent a value uniquely representing the installed application, regardless of the applications installation name or version?
Every question on SO, or other places on the web, that I can find regarding checking for installed software recommends checking to see if the software has been installed by looking it up by name. This would work, however, our software is a global tool that is used on machines with various cultural settings. What we've found is that this naive check doesn't work, even after we provide the install file, because the localization settings in the Microsoft Installer are renaming the application on the machines that are setup for a different, non-English locale.
Is there a "formalized" solution to this problem? As in, is there a documented approach as to how one may check for such software, assuming the developer of the specific tool you are checking for has properly setup their installers to properly configure these ID values?
As an aside, we actually have a couple of Microsoft tools that we need to check for. I didn't want to include a list because I'm hoping there is a moderately straight-forward approach to solving this need for multiple, different tools.
Upvotes: 4
Views: 438
Reputation: 1808
Here are two relevant answers that will help you:
Finding installed applications
Basically there are two GUID values you need to know about: ProductCode and UpgradeCode.
ProductCode identifies the exact installation package used, and should be completely different for each build (assuming the installer was programmed correctly).
UpgradeCode identifies the overall product itself, and should not change between versions (again, assuming the installer was programmed correctly). This is what you need to look for.
One thing you might want to check is whether the developer used different UpgradeCodes for different language versions of the product.
Upvotes: 2