aboutsummaryrefslogtreecommitdiff
path: root/src/WixTestTools/MsiUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixTestTools/MsiUtilities.cs')
-rw-r--r--src/WixTestTools/MsiUtilities.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/WixTestTools/MsiUtilities.cs b/src/WixTestTools/MsiUtilities.cs
index 2a848938..4c7d1601 100644
--- a/src/WixTestTools/MsiUtilities.cs
+++ b/src/WixTestTools/MsiUtilities.cs
@@ -2,6 +2,7 @@
2 2
3namespace WixTestTools 3namespace WixTestTools
4{ 4{
5 using System;
5 using WixToolset.Dtf.WindowsInstaller; 6 using WixToolset.Dtf.WindowsInstaller;
6 7
7 public class MsiUtilities 8 public class MsiUtilities
@@ -23,5 +24,24 @@ namespace WixTestTools
23 } 24 }
24 return false; 25 return false;
25 } 26 }
27
28 /// <summary>
29 /// Return true if it finds the given productcode in system with the specified version otherwise it returns false
30 /// </summary>
31 /// <param name="prodCode"></param>
32 /// <param name="prodVersion"></param>
33 /// <returns></returns>
34 public static bool IsProductInstalledWithVersion(string prodCode, Version prodVersion)
35 {
36 //look in all user's products (both per-machine and per-user)
37 foreach (ProductInstallation product in ProductInstallation.GetProducts(null, "s-1-1-0", UserContexts.All))
38 {
39 if (product.ProductCode == prodCode && product.ProductVersion == prodVersion)
40 {
41 return true;
42 }
43 }
44 return false;
45 }
26 } 46 }
27} 47}