示例#1
0
        /// <summary>
        /// Emulates calling wix.exe with standard backends.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="coreProvider"></param>
        /// <param name="messages"></param>
        /// <param name="warningsAsErrors"></param>
        /// <returns></returns>
        public static Task <int> Execute(string[] args, IWixToolsetCoreServiceProvider coreProvider, out List <Message> messages, bool warningsAsErrors = true)
        {
            coreProvider.AddWindowsInstallerBackend()
            .AddBundleBackend();

            var listener = new TestMessageListener();

            messages = listener.Messages;

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

            messaging.SetListener(listener);

            var arguments = new List <string>(args);

            if (warningsAsErrors)
            {
                arguments.Add("-wx");
            }

            var commandLine = coreProvider.GetService <ICommandLine>();
            var command     = commandLine.CreateCommand(arguments.ToArray());

            return(command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1));
        }
示例#2
0
        protected override Task <int> ExecuteCoreAsync(IWixToolsetCoreServiceProvider coreProvider, string commandLineString, CancellationToken cancellationToken)
        {
            coreProvider.AddWindowsInstallerBackend()
            .AddBundleBackend();

            var commandLine = coreProvider.GetService <ICommandLine>();
            var command     = commandLine.CreateCommand(commandLineString);

            return(command?.ExecuteAsync(cancellationToken) ?? Task.FromResult(1));
        }