public void EnumerablePackageLibrary() { string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../..", "TestData", "Utilities", "ProjectUtility", "EnumerablePackageLibrary", "packages.config"); var packages = ProjectFileUtility.EnumerablePackageLibrary(path).ToList(); Assert.AreEqual(packages.Count, 4); }
public IEnumerable <string> TryGetSourcePaths(string sourcePath) { if (!File.Exists(sourcePath)) { return(null); } var isProject = ProjectFileUtility.IsPathProject(sourcePath); return(isProject ? new[] { sourcePath } : null); }
/// <summary> /// 使用ライブラリ情報を列挙します /// </summary> /// <param name="path"></param> /// <returns></returns> private IEnumerable <string> EnumerableUsingLibrary(string path) { yield return(ProjectFileUtility.GetTargetFramework(path)); var fileInfo = new FileInfo(path); if (fileInfo.Directory?.Exists == true) { string packagePath = Path.Combine(fileInfo.Directory.FullName, "packages.config"); foreach (var package in ProjectFileUtility.EnumerablePackageLibrary(packagePath)) { yield return($"{package.Name} {package.Version}"); } } }
public IEnumerable <string> GetProjectCleanupPaths(PathInfo sourcePath) { var directoryPath = sourcePath.IsFile ? Path.GetDirectoryName(sourcePath.Value) : sourcePath.Value; var projectPaths = ProjectFileUtility.IsPathProject(sourcePath.Value) ? ProjectFileParser.GetProjectFilePaths(sourcePath.Value) : Enumerable.Empty <string>(); foreach (var projectPath in projectPaths) { yield return(Path.Combine(directoryPath, projectPath)); } foreach (var cleanPath in _context.CleanPaths) { yield return(Path.Combine(directoryPath, cleanPath)); } }
public string GetTargetFramework(string projectFilePath) { return(ProjectFileUtility.GetTargetFramework(projectFilePath)); }