/// <summary> /// Generates an advertise script. The method enables the installer to write to a /// script the registry and shortcut information used to assign or publish a product. /// </summary> /// <param name="packagePath">Path to the package of the product being advertised</param> /// <param name="scriptFilePath">path to script file to be created with the advertise information</param> /// <param name="transforms">Semi-colon delimited list of transforms to be applied. This parameter may be null.</param> /// <param name="locale">The language to use if the source supports multiple languages</param> /// <exception cref="FileNotFoundException">the specified package file does not exist</exception> /// <seealso cref="AdvertiseProduct"/> /// <remarks><p> /// Win32 MSI APIs: /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiadvertiseproduct.asp">MsiAdvertiseProduct</a>, /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiadvertiseproductex.asp">MsiAdvertiseProductEx</a> /// </p></remarks> public static void GenerateAdvertiseScript(string packagePath, string scriptFilePath, string transforms, int locale) { if (String.IsNullOrEmpty(packagePath)) { throw new ArgumentNullException("packagePath"); } if (!File.Exists(packagePath)) { throw new FileNotFoundException(null, packagePath); } uint ret = NativeMethods.MsiAdvertiseProduct(packagePath, scriptFilePath, transforms, (ushort)locale); if (ret != 0) { throw InstallerException.ExceptionFromReturnCode(ret); } }