/// <summary>Applies a patch to a product.</summary> /// <param name="PatchPackage"> /// Path to the MSP package. /// </param> /// <param name="InstallPackage"> /// If InstallType is set to MsiInstallType.NetworkImage, this parameter is a null-terminated string that specifies /// a path to the product that is to be patched. If InstallType is set to MsiInstallType.SingleInstance, the /// installer applies the patch to the product whose Product Code is specified in this parameter. /// </param> /// <param name="InstallType"> /// One of the values in MsiInstallType. /// </param> /// <param name="CommandLine"> /// The command line for the patch application. /// </param> public static uint ApplyPatch(string PatchPackage, string InstallPackage, MsiInstallType InstallType, string CommandLine) { if(InstallPackage == null) { if(InstallType == MsiInstallType.NetworkImage) throw new ArgumentException("A path must be passed in InstallPackage if InstallType is NetworkImage."); if(InstallType == MsiInstallType.SingleInstance) throw new ArgumentException( "A product code must be passed in InstallPackage if InstallType is SingleInstance."); } else if(InstallType == MsiInstallType.Default) throw new ArgumentException("InstallPackage must be null if InstallType is Default."); return MsiApplyPatch(PatchPackage, InstallPackage, (int)InstallType, CommandLine); }
public static extern MsiError MsiApplyPatch(string patchPackage, string installPackage, MsiInstallType installType, string commandLine);