Exemplo n.º 1
0
        public static async Task <int> Main(string[] args)
        {
            var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
            var listener        = new ConsoleMessageListener("HEAT", "heat.exe");

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

                return(e.Error.Id);
            }
            catch (Exception e)
            {
                listener.Write(ErrorMessages.UnexpectedException(e));

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

                return(e.HResult);
            }
        }
Exemplo 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);
            }
        }
Exemplo n.º 3
0
        public static async Task <int> Main(string[] args)
        {
            var cts      = new CancellationTokenSource();
            var listener = new ConsoleMessageListener("WIX", "wix.exe");

            Console.CancelKeyPress += (s, e) =>
            {
                cts.Cancel();
                e.Cancel = true;
            };

            try
            {
                var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider()
                                      .AddWindowsInstallerBackend()
                                      .AddBundleBackend()
                                      .AddExtensionCacheManager()
                                      .AddConverter();

                return(await Run(serviceProvider, listener, args, cts.Token));
            }
            catch (OperationCanceledException)
            {
                return(-1);
            }
            catch (WixException e)
            {
                listener.Write(e.Error);

                return(e.Error.Id);
            }
            catch (Exception e)
            {
                listener.Write(ErrorMessages.UnexpectedException(e));

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

                return(e.HResult);
            }
        }