示例#1
0
        public static int Main(string[] args)
        {
            try
            {
                if (args.Length == 0 || args[0] == "-?")
                {
                    PrintHeader();
                    PrintUsage();
                    return(2);
                }

                var commandLine = CommandLine.Parse(args);

                if (!commandLine.NoLogo)
                {
                    PrintHeader();
                }

                string installLocation = commandLine.InstallLocation == null?Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) : commandLine.InstallLocation;

                var test = new HostedAppxTest(args, commandLine.Project, runnerPath, installLocation);

                int returnCode = 0;
                try
                {
                    test.Setup();
                    returnCode = test.Run(commandLine.Debug);
                }
                finally
                {
                    test.Cleanup();
                }

                if (commandLine.Wait)
                {
                    Console.WriteLine();
                    Console.Write("Press any key to continue...");
                    Console.ReadKey();
                    Console.WriteLine();
                }

                return(returnCode);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine($"error: {ex.Message}");
                return(3);
            }
            catch (BadImageFormatException ex)
            {
                Console.WriteLine(ex.Message);
                return(4);
            }
            finally
            {
                Console.ResetColor();
            }
        }
示例#2
0
        public static int Main(string[] args)
        {
            try
            {
                if (args.Length == 0 || args[0] == "-?")
                {
                    PrintHeader();
                    PrintUsage();
                    return 2;
                }

                var commandLine = CommandLine.Parse(args);

                if (!commandLine.NoLogo)
                {
                    PrintHeader();
                }

                string installLocation = commandLine.InstallLocation == null ? Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) : commandLine.InstallLocation;

                var test = new HostedAppxTest(args, commandLine.Project, runnerPath, installLocation);

                int returnCode = 0;
                try
                {
                    test.Setup();
                    returnCode = test.Run(commandLine.Debug);
                }
                finally
                {
                    test.Cleanup();
                }

                if (commandLine.Wait)
                {
                    Console.WriteLine();
                    Console.Write("Press any key to continue...");
                    Console.ReadKey();
                    Console.WriteLine();
                }

                return returnCode;
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine($"error: {ex.Message}");
                return 3;
            }
            catch (BadImageFormatException ex)
            {
                Console.WriteLine(ex.Message);
                return 4;
            }
            finally
            {
                Console.ResetColor();
            }
        }