Ejemplo n.º 1
0
        public override bool Execute()
        {
            var serviceProvider = new WixToolsetServiceProvider();

            var listener = new MsbuildMessageListener(this.Log, "WIX", this.BuildEngine.ProjectFileOfTaskNode);

            try
            {
                this.ExecuteCore(serviceProvider, listener);
            }
            catch (WixException e)
            {
                listener.Write(e.Error);
            }
            catch (Exception e)
            {
                this.Log.LogErrorFromException(e);

                if (e is NullReferenceException || e is SEHException)
                {
                    throw;
                }
            }

            return(!this.Log.HasLoggedErrors);
        }
Ejemplo n.º 2
0
        public static int Main(string[] args)
        {
            var serviceProvider = new WixToolsetServiceProvider();

            var listener = new ConsoleMessageListener("WIX", "wix.exe");

            try
            {
                var program = new Program();
                return(program.Run(serviceProvider, listener, args));
            }
            catch (WixException e)
            {
                listener.Write(e.Error);

                return(e.Error.Id);
            }
            catch (Exception e)
            {
                listener.Write(ErrorMessages.UnexpectedException(e.Message, e.GetType().ToString(), e.StackTrace));

                if (e is NullReferenceException || e is SEHException)
                {
                    throw;
                }

                return(e.HResult);
            }
        }
Ejemplo n.º 3
0
        public static WixRunnerResult Execute(string[] args)
        {
            var serviceProvider = new WixToolsetServiceProvider();
            var exitCode        = Execute(args, serviceProvider, out var messages);

            return(new WixRunnerResult {
                ExitCode = exitCode, Messages = messages.ToArray()
            });
        }
Ejemplo n.º 4
0
        public static int Main(string[] args)
        {
            var serviceProvider = new WixToolsetServiceProvider();

            var listener = new ConsoleMessageListener("WIX", "light.exe");

            Light light = new Light();

            return(light.Run(serviceProvider, listener, args));
        }
Ejemplo n.º 5
0
        public static int Main(string[] args)
        {
            var serviceProvider = new WixToolsetServiceProvider();
            var listener        = new ConsoleMessageListener("WXCP", "wixcop.exe");

            serviceProvider.AddService <IMessageListener>((x, y) => listener);
            serviceProvider.AddService <IWixCopCommandLineParser>((x, y) => new WixCopCommandLineParser(x));

            var program = new Program();

            return(program.Run(serviceProvider, args));
        }
Ejemplo n.º 6
0
        private void ExecuteCore()
        {
            var commandLineBuilder = new WixCommandLineBuilder();

            commandLineBuilder.AppendTextUnquoted("build");

            commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
            commandLineBuilder.AppendSwitchIfNotNull("-outputType ", this.OutputType);
            commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo);
            commandLineBuilder.AppendSwitchIfNotNull("-cultures ", this.Cultures);
            commandLineBuilder.AppendArrayIfNotNull("-d ", this.DefineConstants);
            commandLineBuilder.AppendArrayIfNotNull("-I ", this.IncludeSearchPaths);
            commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.ReferencePaths);
            commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation);
            commandLineBuilder.AppendArrayIfNotNull("-sice ", this.SuppressIces);
            commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile);
            commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath);
            commandLineBuilder.AppendSwitchIfNotNull("-intermediatefolder ", this.IntermediateDirectory);
            commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile);
            commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile);
            commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile);

            commandLineBuilder.AppendIfTrue("-bindFiles", this.BindFiles);
            commandLineBuilder.AppendArrayIfNotNull("-bindPath ", this.CalculateBindPathStrings());
            commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
            commandLineBuilder.AppendArrayIfNotNull("-lib ", this.LibraryFiles);
            commandLineBuilder.AppendTextIfNotWhitespace(this.AdditionalOptions);
            commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");

            var commandLineString = commandLineBuilder.ToString();

            this.Log.LogMessage(MessageImportance.Normal, "wix.exe " + commandLineString);

            var serviceProvider = new WixToolsetServiceProvider();

            var context = serviceProvider.GetService <ICommandLineContext>();

            var messaging = serviceProvider.GetService <IMessaging>();

            messaging.SetListener(this.Listener);

            context.Messaging        = messaging;
            context.ExtensionManager = this.CreateExtensionManagerWithStandardBackends(serviceProvider);
            context.Arguments        = commandLineString;

            var commandLine = serviceProvider.GetService <ICommandLine>();
            var command     = commandLine.ParseStandardCommandLine(context);

            command?.Execute();
        }
Ejemplo n.º 7
0
        public static WixCopRunnerResult Execute(string[] args)
        {
            var listener = new TestMessageListener();

            var serviceProvider = new WixToolsetServiceProvider();

            serviceProvider.AddService <IMessageListener>((x, y) => listener);
            serviceProvider.AddService <IWixCopCommandLineParser>((x, y) => new WixCopCommandLineParser(x));

            var exitCode = Execute(serviceProvider, args);

            return(new WixCopRunnerResult
            {
                ExitCode = exitCode,
                Messages = listener.Messages.ToArray()
            });
        }
Ejemplo n.º 8
0
        public static int Execute(string[] args, out List <Message> messages)
        {
            var listener = new TestListener();

            messages = listener.Messages;

            var serviceProvider = new WixToolsetServiceProvider();

            var messaging = serviceProvider.GetService <IMessaging>();

            messaging.SetListener(listener);

            var arguments = serviceProvider.GetService <ICommandLineArguments>();

            arguments.Populate(args);

            var commandLine = serviceProvider.GetService <ICommandLineParser>();

            commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
            commandLine.Arguments        = arguments;
            var command = commandLine.ParseStandardCommandLine();

            return(command?.Execute() ?? 1);
        }
Ejemplo n.º 9
0
        public static int Execute(string[] args, out List <Message> messages)
        {
            var serviceProvider = new WixToolsetServiceProvider();

            return(Execute(args, serviceProvider, out messages));
        }