Example #1
0
        protected override void ExecuteTask()
        {
            //if (DebugTask && !System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Launch();

            Log(Level.Info, "Set Up");

            try
            {
                if (string.IsNullOrEmpty(base.FileName))
                {
                    base.FileName = "melt.exe";
                }

                const string boolFormat   = @" {0}";
                const string stringFormat = @" {0} {1}";

                string arguments = string.Empty;

                if (NoLogo)
                {
                    arguments += string.Format(boolFormat, @"-nologo");
                }

                if (AllWarningsAsErrors)
                {
                    arguments += string.Format(boolFormat, @"-wxall");
                }
                else if (!string.IsNullOrEmpty(WarningsAsErrors))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -wx{0}", s);
                    }
                }

                if (SupressAllWarnings)
                {
                    arguments += string.Format(boolFormat, @"-swall");
                }
                else if (!string.IsNullOrEmpty(SupressWarning))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -sw{0}", s);
                    }
                }

                if (NoTidy)
                {
                    arguments += string.Format(@" -notidy");
                }

                if (!string.IsNullOrEmpty(ExtractedBinariesPath))
                {
                    arguments += string.Format(@" -x ""{0}""", ExtractedBinariesPath);
                }

                if (!string.IsNullOrEmpty(ExtensionClassAssemblyFullyQualifiedClassName))
                {
                    arguments += string.Format(stringFormat, @"-ext", ExtensionClassAssemblyFullyQualifiedClassName);
                }

                if (base.Verbose)
                {
                    arguments += string.Format(boolFormat, @"-v");
                }

                FileInfo inputFile = new FileInfo(InputInstallerFilename);

                if (!inputFile.Exists)
                {
                    throw new Exception(string.Format("Could not find input file {0}.", inputFile.FullName));
                }

                if (!string.IsNullOrEmpty(MergeModuleWXSOutputFilename) && !string.IsNullOrEmpty(MSIPDBOutputFilename))
                {
                    throw new Exception("attributes, 'msmWXSOutputFilename' AND 'msiPDBOutputFilename' can not BOTH be chosen.");
                }

                if (!string.IsNullOrEmpty(MergeModuleWXSOutputFilename))
                {
                    if (".msm" != inputFile.Extension.ToLower())
                    {
                        throw new Exception("You need to specify a windows installer merge module (.msm extension) in order to get WXS output.");
                    }

                    Log(Level.Info, "Doing MergeModule Melt.");

                    arguments += string.Format(@" ""{0}"" ""{1}""", inputFile.FullName, MergeModuleWXSOutputFilename);
                }
                else if (!string.IsNullOrEmpty(MSIPDBOutputFilename))
                {
                    if (".msi" != inputFile.Extension.ToLower())
                    {
                        throw new Exception("You need to specify a windows installer (.msi extension) in order to get PDB output.");
                    }

                    if (!File.Exists(MSIPDBInputFilename))
                    {
                        throw new Exception(string.Format("Could not find msiPDBInputFilename at {0}", MSIPDBInputFilename));
                    }

                    Log(Level.Info, "Doing MSI Melt.");

                    arguments += string.Format(@" ""{0}"" ""{1}"" -pdb ""{2}""", inputFile.FullName, MSIPDBOutputFilename, MSIPDBInputFilename);
                }

                base.CommandLineArguments = string.Format(@"{0}", arguments);

                Log(Level.Info, base.CommandLineArguments);

                base.ExecuteTask();
                Log(Level.Info, "Done!");
            }
            catch (Exception ex)
            {
                Log(Level.Info, "Exception handled");

                Exception e = ex;
                while (null != e)
                {
                    Log(Level.Error, ex.Message);
                    Log(Level.Error, ex.StackTrace);

                    e = e.InnerException;
                }

                throw;
            }
        }
Example #2
0
        protected override void ExecuteTask()
        {
            if (DebugTask && !System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Launch();
            }

            Log(Level.Info, "Set Up");

            try
            {
                if (string.IsNullOrEmpty(base.FileName))
                {
                    base.FileName = "torch.exe";
                }

                const string boolFormat   = @" {0}";
                const string stringFormat = @" {0} {1}";

                string arguments = string.Empty;

                if (NoLogo)
                {
                    arguments += string.Format(boolFormat, @"-nologo");
                }

                if (AllWarningsAsErrors)
                {
                    arguments += string.Format(boolFormat, @"-wxall");
                }
                else if (!string.IsNullOrEmpty(WarningsAsErrors))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -wx{0}", s);
                    }
                }

                if (SupressAllWarnings)
                {
                    arguments += string.Format(boolFormat, @"-swall");
                }
                else if (!string.IsNullOrEmpty(SupressWarning))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -sw{0}", s);
                    }
                }

                if (AdminImage)
                {
                    arguments += string.Format(@" -a");
                }
                if (NoTidy)
                {
                    arguments += string.Format(@" -notidy");
                }
                if (PreserveUnmodifiedContent)
                {
                    arguments += string.Format(@" -p");
                }
                if (ShowPedanticMessages)
                {
                    arguments += string.Format(@" -pedantic");
                }
                if (WiXInputFormat)
                {
                    arguments += string.Format(@" -xi");
                }
                if (WiXOutputFormat)
                {
                    arguments += string.Format(@" -xo");
                }

                if (!string.IsNullOrEmpty(ExtractedBinariesPath))
                {
                    arguments += string.Format(stringFormat, @"-x ""{0}""", ExtractedBinariesPath);
                }

                if (!string.IsNullOrEmpty(ValidationFlags))
                {
                    string[] flags = ValidationFlags.Split(',');
                    foreach (string f in flags)
                    {
                        switch (f.ToLower())
                        {
                        case "g":
                        case "l":
                        case "r":
                        case "s":
                        case "t":
                        case "u":
                        case "v":
                        case "w":
                        case "x":
                        case "y":
                        case "z":
                            break;

                        default:
                            throw new Exception(string.Format("Bad validation flag value of '{0}' in '{1}'.  Expected any of g,l,r,s,t,u,v,w,x,y,z!  Split on comma is done!", f, ValidationFlags));
                        }
                        arguments += string.Format(stringFormat, @"-val", f);
                    }
                }

                if (!string.IsNullOrEmpty(ValidationErrorsToSupress))
                {
                    string[] errors = ValidationErrorsToSupress.Split(',');
                    foreach (string e in errors)
                    {
                        switch (e.ToLower())
                        {
                        case "a":
                        case "b":
                        case "c":
                        case "d":
                        case "e":
                        case "f":
                            break;

                        default:
                            throw new Exception(string.Format("Bad validationErrorToSupress value of '{0}' in '{1}'.  Expected a through f!  Split on comma is done!", e, ValidationErrorsToSupress));
                        }
                        arguments += string.Format(stringFormat, @"-serr", e);
                    }
                }

                if (!string.IsNullOrEmpty(TransformationType))
                {
                    switch (TransformationType.ToLower())
                    {
                    case "language":
                    case "instance":
                    case "patch":
                        break;

                    default:
                        throw new Exception("Bad transformationType.  language || instance || patch !!!");
                    }
                    ;
                    arguments += string.Format(stringFormat, @"-t", TransformationType);
                }

                if (!string.IsNullOrEmpty(ExtensionClassAssemblyFullyQualifiedClassName))
                {
                    arguments += string.Format(stringFormat, @"-ext", ExtensionClassAssemblyFullyQualifiedClassName);
                }

                if (base.Verbose)
                {
                    arguments += string.Format(boolFormat, @"-v");
                }

                FileInfo targetMSIFile  = new FileInfo(TargetInputMSIFilename);
                FileInfo updatedMSIFile = new FileInfo(UpdatedInputMSIFilename);

                if (!targetMSIFile.Exists)
                {
                    throw new FileNotFoundException(string.Format("Can't find target (RTM) MSI file at [{0}].", targetMSIFile.FullName));
                }
                if (!updatedMSIFile.Exists)
                {
                    throw new FileNotFoundException(string.Format("Can't find updated (Upgrade) MSI file at [{0}].", updatedMSIFile.FullName));
                }

                base.CommandLineArguments = string.Format(@"{0} ""{1}"" ""{2}"" -out {3}", arguments, targetMSIFile.FullName, updatedMSIFile.FullName, Out);

                Log(Level.Info, base.CommandLineArguments);

                base.ExecuteTask();
                Log(Level.Info, "Done!");
            }
            catch (Exception ex)
            {
                Log(Level.Info, "Exception handled");

                Exception e = ex;
                while (null != e)
                {
                    Log(Level.Error, ex.Message);
                    Log(Level.Error, ex.StackTrace);

                    e = e.InnerException;
                }

                throw;
            }
        }
Example #3
0
        protected override void ExecuteTask()
        {
            if (DebugTask && !System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Launch();
            }

            Log(Level.Info, "Set Up");

            try
            {
                if (string.IsNullOrEmpty(base.FileName))
                {
                    base.FileName = "pyro.exe";
                }

                const string boolFormat   = @" {0}";
                const string stringFormat = @" {0} {1}";

                string arguments = string.Empty;

                if (NoLogo)
                {
                    arguments += string.Format(boolFormat, @"-nologo");
                }

                if (AllWarningsAsErrors)
                {
                    arguments += string.Format(boolFormat, @"-wxall");
                }
                else if (!string.IsNullOrEmpty(WarningsAsErrors))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -wx{0}", s);
                    }
                }

                if (SupressAllWarnings)
                {
                    arguments += string.Format(boolFormat, @"-swall");
                }
                else if (!string.IsNullOrEmpty(SupressWarning))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -sw{0}", s);
                    }
                }

                if (NoTidy)
                {
                    arguments += string.Format(boolFormat, @"-notidy");
                }

                if (!string.IsNullOrEmpty(ExtensionClassAssemblyFullyQualifiedClassName))
                {
                    arguments += string.Format(@" -ext ""{0}""", ExtensionClassAssemblyFullyQualifiedClassName);
                }

                if (base.Verbose)
                {
                    arguments += string.Format(boolFormat, @"-v");
                }

                if (SupressAssemblies)
                {
                    arguments += string.Format(boolFormat, @"-sa");
                }
                if (SupressFiles)
                {
                    arguments += string.Format(boolFormat, @"-sf");
                }
                if (SupressFileInfo)
                {
                    arguments += string.Format(boolFormat, @"-sh");
                }
                if (SupressWiXPDBOutput)
                {
                    arguments += string.Format(boolFormat, @"-spdb");
                }
                if (ResueCABFiles)
                {
                    arguments += string.Format(boolFormat, @"-reusecab");
                }
                if (UpdateFileVersionEntries)
                {
                    arguments += string.Format(boolFormat, @"-fv");
                }
                if (CreateBinayDeltaPatch)
                {
                    arguments += string.Format(boolFormat, @"-delta");
                }

                if (!string.IsNullOrEmpty(NewBindPathForTarget))
                {
                    arguments += string.Format(@" -bt ""{0}""", NewBindPathForTarget);
                }
                if (!string.IsNullOrEmpty(NewBindPathForUpgrade))
                {
                    arguments += string.Format(@" -bu ""{0}""", NewBindPathForUpgrade);
                }

                if (null != CabCachePath && !CabCachePath.Exists)
                {
                    arguments += string.Format(@" -cc ""{0}""", CabCachePath);
                }

                if (!string.IsNullOrEmpty(PDBOutputFilename))
                {
                    arguments += string.Format(@" -pdbout ""{0}""", PDBOutputFilename);
                }

                if (null == InElement || 0 == InElement.Items.AsIs.Count)
                {
                    Log(Level.Info, @"Empty items!"); return;
                }

                foreach (string baselineArg in InElement.Items.AsIs)
                {
                    string[] parts = baselineArg.Split(';');
                    arguments += string.Format(@" -t {0} {1}", parts[0], parts[1]);
                }

                base.CommandLineArguments = string.Format(@"""{0}"" {2} -out ""{1}""", InputFilename, Out, arguments);

                Log(Level.Info, base.CommandLineArguments);

                base.ExecuteTask();
                Log(Level.Info, "Done!");
            }
            catch (Exception ex)
            {
                Log(Level.Info, "Exception handled");

                Exception e = ex;
                while (null != e)
                {
                    Log(Level.Error, ex.Message);
                    Log(Level.Error, ex.StackTrace);

                    e = e.InnerException;
                }

                throw;
            }
        }
Example #4
0
        protected override void ExecuteTask()
        {
            if (DebugTask && !System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Launch();
            }

            Log(Level.Info, "Set Up");

            try
            {
                if (string.IsNullOrEmpty(base.FileName))
                {
                    base.FileName = "light.exe";
                }

                const string boolFormat   = @" {0}";
                const string stringFormat = @" {0} {1}";

                string arguments = string.Empty;

                if (NoLogo)
                {
                    arguments += string.Format(boolFormat, @"-nologo");
                }

                if (AllWarningsAsErrors)
                {
                    arguments += string.Format(boolFormat, @"-wxall");
                }
                else if (!string.IsNullOrEmpty(WarningsAsErrors))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -wx{0}", s);
                    }
                }

                if (SupressAllWarnings)
                {
                    arguments += string.Format(boolFormat, @"-swall");
                }
                else if (!string.IsNullOrEmpty(SupressWarning))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -sw{0}", s);
                    }
                }

                if (NoTidy)
                {
                    arguments += string.Format(@" -notidy");
                }

                if (!string.IsNullOrEmpty(ExtensionClassAssemblyFullyQualifiedClassName))
                {
                    arguments += string.Format(stringFormat, @"-ext", ExtensionClassAssemblyFullyQualifiedClassName);
                }

                if (base.Verbose)
                {
                    arguments += string.Format(boolFormat, @"-v");
                }

                if (!string.IsNullOrEmpty(BinderPath))
                {
                    arguments += string.Format(@" -b ""{0}""", BinderPath);
                }

                arguments += string.Format(@" -out ""{0}""", Out);

                foreach (string objectFile in InElement.Items.AsIs)
                {
                    if (!File.Exists(objectFile))
                    {
                        throw new Exception(string.Format("File {0} not found.", objectFile));
                    }

                    arguments += string.Format(@" ""{0}""", objectFile);
                }

                base.CommandLineArguments = string.Format(@"{0}", arguments);

                Log(Level.Info, base.CommandLineArguments);

                base.ExecuteTask();
                Log(Level.Info, "Done!");
            }
            catch (Exception ex)
            {
                Log(Level.Info, "Exception handled");

                Exception e = ex;
                while (null != e)
                {
                    Log(Level.Error, ex.Message);
                    Log(Level.Error, ex.StackTrace);

                    e = e.InnerException;
                }

                throw;
            }
        }
Example #5
0
        protected override void ExecuteTask()
        {
            if (DebugTask && !System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Launch();
            }

            Log(Level.Info, "Set Up");

            try
            {
                base.FileName = "heat.exe";

                const string boolFormat   = @" {0}";
                const string stringFormat = @" {0} {1}";

                string arguments = string.Empty;
                if (AllWarningsAsErrors)
                {
                    arguments += string.Format(boolFormat, @"-wxall");
                }

                if (!string.IsNullOrEmpty(WarningsAsErrors))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -wx{0}", s);
                    }
                }

                if (!string.IsNullOrEmpty(SupressWarning))
                {
                    string[] warnings = WarningsAsErrors.Split(',');
                    foreach (string s in warnings)
                    {
                        arguments += string.Format(@" -sw{0}", s);
                    }
                }

                if (WixVar)
                {
                    arguments += string.Format(boolFormat, @"-wixvar");
                }

                if (!string.IsNullOrEmpty(Var))
                {
                    arguments += string.Format(stringFormat, @"-var", Var);
                }

                if (base.Verbose)
                {
                    arguments += string.Format(boolFormat, @"-v");
                }

                if (!string.IsNullOrEmpty(Template))
                {
                    arguments += string.Format(stringFormat, @"-template", Template);
                }

                if (!string.IsNullOrEmpty(TransformXSLTFilename))
                {
                    arguments += string.Format(stringFormat, @"-t", TransformXSLTFilename);
                }

                if (SupressAllWarnings)
                {
                    arguments += string.Format(boolFormat, @"-swall");
                }

                if (SVB6)
                {
                    arguments += string.Format(boolFormat, @"-svb6");
                }

                if (SUID)
                {
                    arguments += string.Format(boolFormat, @"-suid");
                }

                if (SREG)
                {
                    arguments += string.Format(boolFormat, @"-sreg");
                }

                if (SRD)
                {
                    arguments += string.Format(boolFormat, @"-srd");
                }

                if (SFRAG)
                {
                    arguments += string.Format(boolFormat, @"-sfrag");
                }

                if (SCOM)
                {
                    arguments += string.Format(boolFormat, @"-scom");
                }

                if (!string.IsNullOrEmpty(ProjectName))
                {
                    arguments += string.Format(stringFormat, @"-projectname", ProjectName);
                }

                if (!string.IsNullOrEmpty(Platform))
                {
                    arguments += string.Format(stringFormat, @"-platform", Platform);
                }

                if (NoLogo)
                {
                    arguments += string.Format(boolFormat, @"-nologo");
                }

                if (KeepEmptyDirectories)
                {
                    arguments += string.Format(boolFormat, @"-ke");
                }

                if (GenerateGuidsNow)
                {
                    arguments += string.Format(boolFormat, @"-gg");
                }

                if (!string.IsNullOrEmpty(Generate))
                {
                    arguments += string.Format(stringFormat, @"-generate", Generate);
                }

                if (!string.IsNullOrEmpty(ExtensionClassAssemblyFullyQualifiedClassName))
                {
                    arguments += string.Format(stringFormat, @"-ext", ExtensionClassAssemblyFullyQualifiedClassName);
                }

                if (!string.IsNullOrEmpty(DirectoryName))
                {
                    arguments += string.Format(stringFormat, @"-dr", DirectoryName);
                }

                if (!string.IsNullOrEmpty(DirectoryId))
                {
                    arguments += string.Format(stringFormat, @"-directoryid", DirectoryId);
                }

                if (!string.IsNullOrEmpty(Configuration))
                {
                    arguments += string.Format(stringFormat, @"-configuration", Configuration);
                }

                if (!string.IsNullOrEmpty(ComponentGroupName))
                {
                    arguments += string.Format(stringFormat, @"-cg", ComponentGroupName);
                }

                if (AutoGenerateGuidsAtCompileTime)
                {
                    arguments += string.Format(boolFormat, @"-ag");
                }

                base.CommandLineArguments = string.Format(@"{0} ""{1}""{2} -out {3}", HarvestType, HarvestSource, arguments, Out);

                Log(Level.Info, base.CommandLineArguments);

                base.ExecuteTask();
                Log(Level.Info, "Done!");
            }
            catch (Exception ex)
            {
                Log(Level.Info, "Exception handled");

                Exception e = ex;
                while (null != e)
                {
                    Log(Level.Error, ex.Message);
                    Log(Level.Error, ex.StackTrace);

                    e = e.InnerException;
                }

                throw;
            }
        }