diff --git a/README.md b/README.md index 291039e0..df624374 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,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 f200855a..1d17380f 100644 --- a/src/Methods.cs +++ b/src/Methods.cs @@ -371,8 +371,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 @@ -865,11 +865,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; }