private static bool IsEndPoint(Proj project)
        {
            // Endpoint could be a console app, a webforms app, an mvc app, or an NServiceBus Host
            if (ProjectTools.HasFile(project, "web.config"))
            {
                // mvc app, webforms app
                return(true);
            }

            if (ProjectTools.CsProjContainsString(project, "<OutputType>Exe</OutputType>"))
            {
                // console app
                return(true);
            }

            if (NuGetTools.HasNServiceBusHostInstalled(project))
            {
                return(true);
            }

            if (NuGetTools.HasXUnitInstalled(project))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private static bool HasNuGetPackageInstalled(Proj project, string packageName)
        {
            var items        = project.ProjectItems;
            var packagesJson = GetPackagesItem(items);

            if (packagesJson != null)
            {
                var packagesContent = System.IO.File.ReadAllText(packagesJson.FileName);
                return(packagesContent.Contains($"<package id=\"{packageName}\""));
            }
            else
            {
                return(ProjectTools.CsProjContainsString(
                           project,
                           $"<PackageReference Include=\"{packageName}\""));
            }
        }
Esempio n. 3
0
 public static bool HasStyleCopSetting(Proj p) => ProjectTools.CsProjContainsString(p, StyleCopSetting);
Esempio n. 4
0
 public static bool HasWarningsAsErrors(Proj p) => ProjectTools.CsProjContainsString(p, WarningsAsErrors);
Esempio n. 5
0
        public static bool HasBadNugetPackages(Proj p)
        {
            var fails = new[] { @"<HintPath>C:\Users\", @"<HintPath>C:\Program Files\dotnet\sdk\NuGetFallbackFolder\" };

            return(fails.Any(f => ProjectTools.CsProjContainsString(p, f)) || ProjectTools.CsProjMatches(p, RegexInvalidPackage));
        }