Esempio n. 1
0
        public static void FindMissingPackConfigEntries()
        {
            foreach (var csProj in Wand.GetCsProjFiles(Wand.MercurySourceDir).ToArray())
            {
                var missingCsProjNugetReferences = new Librarian(NugetReferenceFromCsProjPattern, csProj.Text)
                                                   .Get("capturegroup")
                                                   .Where(token => token.Contains("\\packages\\"))
                                                   .Where(csProjNugetReference =>
                {
                    var nugetId = new Librarian(NugetIdFromNugetReference, csProjNugetReference)
                                  .Get("capturegroup")
                                  .Single()
                                  .TrimEnd('.');


                    var pc = csProj.PackagesConfig();
                    var nr = pc
                             .NugetpackageReferences;
                    return(!nr
                           .Any(entry => string.Equals(entry.Id, nugetId, StringComparison.InvariantCultureIgnoreCase)));
                }).ToArray();
                if (missingCsProjNugetReferences.Length > 0)
                {
                    Console.WriteLine($"{csProj} is missing package.config entires for ");
                    foreach (var reference in missingCsProjNugetReferences)
                    {
                        Console.WriteLine($"    {reference}");
                    }
                }
            }
        }
Esempio n. 2
0
 private static string[] GetAllBogusReferences(string path)
 {
     return(File.ReadLines(path)
            .Select(Match)
            .Where(m => m.Success)
            .Select(m => m.Value)
            .Select(relPath => Wand.ToAbsolutePath(relPath, Directory.GetParent(path).FullName))
            .Where(absPath => !File.Exists(absPath))
            .ToArray());
 }
Esempio n. 3
0
        public static IEnumerable <SlnFile> SolutionsThatReference(CsProj csProj)
        {
            var slns = Wand.GetSolutionFiles(Wand.MercurySourceDir);

            foreach (var slnFile in slns)
            {
                if (slnFile.ContainsProjectReference(csProj))
                {
                    yield return(slnFile);
                }
            }
        }
Esempio n. 4
0
        private static string[] GetHostPaths()
        {
            var serviceJsonPath = Path.Combine(Wand.MercurySourceDir, @"..\Hosting\AllServices.json");
            var serviceJson     = File.ReadAllText(serviceJsonPath);
            var roles           = (JArray)JObject.Parse(serviceJson)["Roles"];

            return(roles.Select(r => r["Assembly"].ToString())
                   .Select(relPath => Wand.ToAbsolutePath(relPath, Wand.MercurySourceDir))
                   //Strip everything after \bin\
                   .Select(absPath => GetUntil(absPath, @"\bin\"))
                   .ToArray());
            //
        }