Exemple #1
0
        internal static int Main(string[] args)
        {
            SignToolArgs signToolArgs;

            if (!ParseCommandLineArguments(StandardHost.Instance, args, out signToolArgs))
            {
                PrintUsage();
                return(ExitFailure);
            }

            if (!signToolArgs.Test && !File.Exists(signToolArgs.MSBuildPath))
            {
                Console.WriteLine($"Unable to locate MSBuild at the path '{signToolArgs.MSBuildPath}'.");
                return(ExitFailure);
            }

            var signTool  = SignToolFactory.Create(signToolArgs);
            var batchData = ReadConfigFile(signToolArgs.OutputPath, signToolArgs.ConfigFile);
            var util      = new BatchSignUtil(signTool, batchData);

            try
            {
                return(util.Go(Console.Out) ? ExitSuccess : ExitFailure);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Unexpected exception: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
                return(1);
            }
        }
Exemple #2
0
        internal static void Main(string[] args)
        {
            SignToolArgs signToolArgs;

            if (!ParseCommandLineArguments(StandardHost.Instance, args, out signToolArgs))
            {
                PrintUsage();
                Environment.Exit(1);
            }

            if (signToolArgs.MSBuildPath != null && !File.Exists(signToolArgs.MSBuildPath))
            {
                Console.WriteLine($"Unable to locate MSBuild at the path '{signToolArgs.MSBuildPath}'.");
                Environment.Exit(1);
            }

            if (signToolArgs.DotnetPath != null && !File.Exists(signToolArgs.DotnetPath))
            {
                Console.WriteLine($"Unable to locate dotnet at the path '{signToolArgs.DotnetPath}'.");
                Environment.Exit(1);
            }

            // A default msbuild path was set.
            Debug.Assert(signToolArgs.MSBuildPath != null || signToolArgs.DotnetPath != null);

            var signTool  = SignToolFactory.Create(signToolArgs);
            var batchData = ReadConfigFile(signToolArgs.OutputPath, signToolArgs.ConfigFile);
            var util      = new BatchSignUtil(signTool, batchData);

            util.Go();
        }
Exemple #3
0
        internal static int Main(string[] args)
        {
            if (!ParseCommandLineArguments(StandardHost.Instance, args, out SignToolArgs signToolArgs))
            {
                PrintUsage();
                return(ExitFailure);
            }

            if (!signToolArgs.Test && !File.Exists(signToolArgs.MSBuildPath))
            {
                Console.WriteLine($"Unable to locate MSBuild at the path '{signToolArgs.MSBuildPath}'.");
                return(ExitFailure);
            }

            BatchSignInput batchData;
            var            signTool       = SignToolFactory.Create(signToolArgs);
            string         configFileKind = GetConfigFileKind(signToolArgs.ConfigFile);

            switch (configFileKind.ToLower())
            {
            case "default":
                batchData = ReadConfigFile(signToolArgs.OutputPath, signToolArgs.ConfigFile);
                break;

            case "orchestration":
                batchData = ReadOrchestrationConfigFile(signToolArgs.OutputPath, signToolArgs.ConfigFile);
                break;

            default:
                Console.WriteLine($"signtool : error : Don't know how to deal with manifest kind '{configFileKind}'");
                return(1);
            }

            var util = new BatchSignUtil(signTool, batchData, signToolArgs.OrchestrationManifestPath);

            try
            {
                return(util.Go(Console.Out) ? ExitSuccess : ExitFailure);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Unexpected exception: {ex.Message}");
                Console.WriteLine(ex.StackTrace);
                return(1);
            }
        }