有谁知道,给定标识已安装产品的GUID,您如何使用C#找到为该产品安装的修补程序?
应用程序非常复杂,我们不时地通过Orca/MSI创建补丁(MSP文件)。然后,这些补丁可以安装在客户的计算机上,然后可以在程序和功能下的“查看已安装的更新”中查看。
我试过两种方法:
不一样
This question讨论了类似的问题,但是提问者正在寻找Windows修补程序,而我需要自己的应用程序补丁--所以解决方案对我来说并不有效。
提前谢谢。
发布于 2012-01-04 11:33:51
我能够通过将从ProductCode返回的Win32_PatchPackage插入到Win32 dll中来实现这一点,然后使用它。
[DllImport("msi.dll", CharSet = CharSet.Unicode)]
internal static extern Int32 MsiGetPatchInfoEx(string szPatchCode, string szProductCode, string szUserSid, int dwContext, string szProperty, [Out] StringBuilder lpValue, ref Int32 pcchValue);
// See http://msdn.microsoft.com/en-us/library/windows/desktop/aa370128%28v=vs.85%29.aspx
// for valid values for the property paramater
private static string getPatchInfoProperty(string patchCode, string productCode, string property)
{
StringBuilder output = new StringBuilder(512);
int len = 512;
MsiGetPatchInfoEx(patchCode, productCode, null, 4, property, output, ref len);
return output.ToString();
}
public static string GetPatchDisplayName(string patchCode, string productCode)
{
return getPatchInfoProperty(patchCode, productCode, "DisplayName");
}https://stackoverflow.com/questions/8616175
复制相似问题