private static void RestoreToolToPath(LibraryRange tooldep, IEnumerable <string> args, string tempPath) { Directory.CreateDirectory(tempPath); var projectPath = Path.Combine(tempPath, Project.FileName); File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] { "dnxcore50" })); Dnx.RunPackageInstall(tooldep, projectPath, args); Dnx.RunRestore(new [] { $"\"{projectPath}\"", "--runtime", $"{RuntimeIdentifier.Current}" }.Concat(args)); }
private static void RestoreToolToPath(LibraryRange tooldep, IEnumerable <string> args, string tempPath) { Directory.CreateDirectory(tempPath); var projectPath = Path.Combine(tempPath, Project.FileName); Console.WriteLine($"Restoring Tool '{tooldep.Name}' for '{projectPath}' in '{tempPath}'"); File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] { "dnxcore50" })); Dnx.RunPackageInstall(tooldep, projectPath, args); Dnx.RunRestore(new [] { $"\"{projectPath}\"", "--runtime", $"{DefaultRid}" }.Concat(args)); }
public static int Main(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" }; app.OnExecute(() => { try { var projectRestoreResult = Dnx.RunRestore(args); var restoreTasks = GetRestoreTasks(args); foreach (var restoreTask in restoreTasks) { var project = ProjectReader.GetProject(restoreTask.ProjectPath); RestoreTools(project, restoreTask.Arguments); } return(projectRestoreResult); } catch (InvalidOperationException e) { Console.WriteLine(e.Message); return(-1); } catch (Exception e) { Console.WriteLine(e.Message); return(-2); } }); return(app.Execute(args)); }