This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cli/src/dotnet/commands/dotnet-restore/Program.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
55 lines (46 sloc)
1.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright (c) .NET Foundation and contributors. All rights reserved. | |
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | |
| using System; | |
| using System.Linq; | |
| using Microsoft.DotNet.Cli.CommandLine; | |
| using Microsoft.DotNet.Cli.Utils; | |
| using Microsoft.DotNet.InternalAbstractions; | |
| namespace Microsoft.DotNet.Tools.Restore | |
| { | |
| public partial class RestoreCommand | |
| { | |
| private static readonly string DefaultRid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier(); | |
| public static int Run(string[] args) | |
| { | |
| DebugHelper.HandleDebugSwitch(ref args); | |
| var app = new CommandLineApplication(false) | |
| { | |
| Name = "dotnet restore", | |
| FullName = ".NET project dependency restorer", | |
| Description = "Restores dependencies listed in project.json" | |
| }; | |
| // Parse --quiet, because we have to handle that specially since NuGet3 has a different | |
| // "--verbosity" switch that goes BEFORE the command | |
| var quiet = args.Any(s => s.Equals("--quiet", StringComparison.OrdinalIgnoreCase)); | |
| args = args.Where(s => !s.Equals("--quiet", StringComparison.OrdinalIgnoreCase)).ToArray(); | |
| app.OnExecute(() => | |
| { | |
| try | |
| { | |
| return NuGet3.Restore(args, quiet); | |
| } | |
| catch (InvalidOperationException e) | |
| { | |
| Console.WriteLine(e.Message); | |
| return -1; | |
| } | |
| catch (Exception e) | |
| { | |
| Console.WriteLine(e.Message); | |
| return -2; | |
| } | |
| }); | |
| return app.Execute(args); | |
| } | |
| } | |
| } |