Beispiel #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.AddBundleBackend();

            var listener = new TestMessageListener();

            messages = listener.Messages;

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

            messaging.SetListener(listener);

            if (warningsAsErrors)
            {
                messaging.WarningsAsError = true;
            }

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

            arguments.Populate(args);

            var commandLine = HeatCommandLineFactory.CreateCommandLine(coreProvider);
            var command     = commandLine.ParseStandardCommandLine(arguments);

            return(command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1));
        }
Beispiel #2
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));
        }
        /// <summary>
        /// Adds Converters services.
        /// </summary>
        /// <param name="coreProvider"></param>
        /// <returns></returns>
        public static IWixToolsetCoreServiceProvider AddConverter(this IWixToolsetCoreServiceProvider coreProvider)
        {
            var extensionManager = coreProvider.GetService <IExtensionManager>();

            extensionManager.Add(typeof(ConverterExtensionFactory).Assembly);

            return(coreProvider);
        }
        /// <summary>
        /// Adds ExtensionCache services.
        /// </summary>
        /// <param name="coreProvider"></param>
        /// <returns></returns>
        public static IWixToolsetCoreServiceProvider AddExtensionCacheManager(this IWixToolsetCoreServiceProvider coreProvider)
        {
            var extensionManager = coreProvider.GetService <IExtensionManager>();

            extensionManager.Add(typeof(ExtensionCacheManagerExtensionFactory).Assembly);

            coreProvider.AddService(CreateExtensionCacheManager);
            return(coreProvider);
        }
Beispiel #5
0
        public static IWixToolsetCoreServiceProvider AddBundleBackend(this IWixToolsetCoreServiceProvider coreProvider)
        {
            AddServices(coreProvider);

            var extensionManager = coreProvider.GetService <IExtensionManager>();

            extensionManager.Add(typeof(BurnExtensionFactory).Assembly);

            return(coreProvider);
        }
Beispiel #6
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));
        }