Пример #1
0
        public static async Task Main(string[] args)
        {
            if (!TryParseCommandLine(args, out var rootPath, out var verbose, out var help))
            {
                PrintUsage();
                Environment.Exit(1);
                return;
            }

            if (help)
            {
                PrintUsage();
                PrintUsage();
                Environment.Exit(0);
                return;
            }

            Log.IsEnabled = verbose;

            rootPath = Path.GetFullPath(rootPath);
            var builder      = new PackageReferenceModelBuilder(rootPath);
            var projectFiles = CsprojLocator.Locate(rootPath);

            foreach (var projectFile in projectFiles)
            {
                CsprojParser.Parse(projectFile, builder);
            }

            var model = builder.Build();

            PrintModelData(model);

            await CsprojGenerator.Generate(model, Console.Out);
        }
Пример #2
0
        public static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Error.WriteLine("USAGE:");
                Console.Error.WriteLine("dotnet-package-cache-gen <path-to-directory>");
                Environment.Exit(1);
                return;
            }

            var builder  = new PackageReferenceModelBuilder();
            var rootPath = args[0];

            rootPath = Path.GetFullPath(rootPath);
            Console.Error.WriteLine($"RootPath: {rootPath}");
            var projectFiles = CsprojLocator.Locate(rootPath);

            foreach (var projectFile in projectFiles)
            {
                CsprojParser.Parse(projectFile, builder);
            }

            var model = builder.Build();

            CsprojGenerator.Generate(model, Console.Out);

            PrintModelData(model);
        }