diff --git a/README.md b/README.md index 05d96e1c..986318f7 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ dotnet-project-licenses -i projectFolder ### Print unique licenses -Values for the input may include a folder path, a Visual Studio '.sln' file, a '.csproj' or a '.fsproj' file or a '.vbproj' file. +Values for the input may include a folder path, a Visual Studio '.sln' file, a '.csproj' or a '.fsproj' file or a '.vbproj' file or the 'Directory.Build.props' file. ```ps dotnet-project-licenses -i projectFolder -u diff --git a/src/Methods.cs b/src/Methods.cs index c0a93e59..36acc62d 100644 --- a/src/Methods.cs +++ b/src/Methods.cs @@ -360,8 +360,8 @@ public async Task> GetPackages() public string[] GetProjectExtensions(bool withWildcard = false) => withWildcard ? - new[] { "*.csproj", "*.fsproj", "*.vbproj" } : - new[] { ".csproj", ".fsproj", ".vbproj" }; + new[] { "*.csproj", "*.fsproj", "*.vbproj", "Directory.Build.props" } : + new[] { ".csproj", ".fsproj", ".vbproj", "Directory.Build.props" }; /// /// Retreive the project references from csproj or fsproj file @@ -817,11 +817,18 @@ private async Task> GetValidProjects(string projectPath) .ToList(); break; default: - validProjects = - GetProjectExtensions(withWildcard: true) - .SelectMany(wildcardExtension => - Directory.EnumerateFiles(projectPath, wildcardExtension, SearchOption.AllDirectories) - ); + if (pathInfo.Name == "Directory.Build.props") + { + validProjects = new string[] { projectPath }; + } + else + { + validProjects = + GetProjectExtensions(withWildcard: true) + .SelectMany(wildcardExtension => + Directory.EnumerateFiles(projectPath, wildcardExtension, SearchOption.AllDirectories) + ); + } break; }