Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also evaluate licenses in Directory.Build.props #116

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions src/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ public async Task<Dictionary<string, PackageList>> 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" };

/// <summary>
/// Retreive the project references from csproj or fsproj file
Expand Down Expand Up @@ -817,11 +817,18 @@ private async Task<IEnumerable<string>> 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;
}

Expand Down