コード例 #1
0
    static async Task ProcessSolution(string solution, string?package)
    {
        if (Excluder.ShouldExclude(solution))
        {
            Console.WriteLine($"  Exclude: {solution}");
            return;
        }

        Console.WriteLine($"  {solution}");
        await SolutionRestore.Run(solution);

        var solutionDirectory = Directory.GetParent(solution) !.FullName;

        foreach (var project in FileSystem.EnumerateFiles(solutionDirectory, "*.csproj"))
        {
            Console.WriteLine($"    {project.Replace(solutionDirectory, "").Trim(Path.DirectorySeparatorChar)}");
            foreach (var pending in await PendingUpdateReader.ReadPendingUpdates(project))
            {
                if (package == null)
                {
                    await Update(project, pending.Package, pending.Latest);

                    continue;
                }

                if (string.Equals(package, pending.Package, StringComparison.OrdinalIgnoreCase))
                {
                    await Update(project, pending.Package, pending.Latest);
                }
            }
        }
    }
コード例 #2
0
 public void Simple()
 {
     Environment.SetEnvironmentVariable("PackageUpdateIgnores", "ignore, otherIgnore");
     Assert.True(Excluder.ShouldExclude("SolutionToIgnore.sln"));
     Assert.True(Excluder.ShouldExclude("SolutionOtherIgnore.sln"));
     Assert.False(Excluder.ShouldExclude("Solution.sln"));
 }