コード例 #1
0
        public override bool Execute()
        {
            Log.LogMessage(MessageImportance.Normal, "Copying script install package template '{0}' to script install package target '{1}'...", ScriptInstallPackageSourcePath, ScriptInstallPackageTargetPath);
            DirectoryOperation.CopyDirectory(ScriptInstallPackageSourcePath, ScriptInstallPackageTargetPath);

            Log.LogMessage(MessageImportance.Normal, "Copying Windows Installer file '{0}' to script install package target '{1}'...", SourceMsiFile, TargetMsiFile);
            File.Copy(SourceMsiFile, TargetMsiFile, true);

            Log.LogMessage(MessageImportance.Normal, "Updating vendor install ini '{0}'...", VendorInstallIni);
            if (!File.Exists(VendorInstallIni))
            {
                throw new FileNotFoundException("Vendor install ini file not found: " + VendorInstallIni);
            }
            var iniFileOperation = new IniFileOperation();

            iniFileOperation.Write(VendorInstallIni, "VendorInstall", "MsiFile", Path.GetFileName(TargetMsiFile));

            Log.LogMessage(MessageImportance.Normal, "Updating package definition file '{0}'...", PackageDefinitionSms);

            iniFileOperation.Write(PackageDefinitionSms, "Package Definition", "Name", PackageDefinitionName);
            iniFileOperation.Write(PackageDefinitionSms, "Package Definition", "Version", PackageDefinitionVersion);
            iniFileOperation.Write(PackageDefinitionSms, "Package Definition", "Publisher", PackageDefinitionPublisher);
            iniFileOperation.Write(PackageDefinitionSms, "Package Definition", "Comment", PackageDefinitionComment);
            iniFileOperation.Write(PackageDefinitionSms, "INSTALL", "CommandLine", PackageDefinitionInstallCommandLine);
            iniFileOperation.Write(PackageDefinitionSms, "UNINSTALL", "CommandLine", PackageDefinitionUnInstallCommandLine);
            var msiFileOperation = new MsiFileOperation();

            iniFileOperation.Write(PackageDefinitionSms, "DetectionMethod", "MsiProductCode", msiFileOperation.GetMsiProductCode(TargetMsiFile));

            WriteDependencies(iniFileOperation, PackageDefinitionSms);

            return(base.Execute());
        }
コード例 #2
0
 private static void WriteDependency(IniFileOperation iniFileOperation, string packageDefinitionSms, string dependencyKeyName, string dependencyValueName)
 {
     if (!string.IsNullOrWhiteSpace(dependencyValueName))
     {
         iniFileOperation.Write(packageDefinitionSms, "Dependencies", dependencyKeyName, dependencyValueName);
     }
 }