Exemplo n.º 1
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();
        }
Exemplo n.º 2
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);
        }