From a245c473a2ac753af0d48a4f970273661d5bef2f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 20:43:37 +0000 Subject: [PATCH 1/4] Initial plan From bb4cd46f3fd4d0ff4f051303a29ad3e8978ffc9c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 20:46:56 +0000 Subject: [PATCH 2/4] Add GitHub Copilot instructions file Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com> --- .github/copilot-instructions.md | 145 ++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..f6c508f5 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,145 @@ +# GitHub Copilot Instructions for nuget-license + +## Project Overview + +This repository contains **nuget-license**, a .NET tool for analyzing, printing, and validating licenses of NuGet package dependencies in .NET and C++ projects. The project supports .NET Core, .NET Standard, .NET Framework, and native C++ projects. + +## Project Structure + +- **src/**: Source code for the main tools + - **NuGetLicenseCore/**: Cross-platform .NET Core global tool + - **NuGetLicenseFramework/**: .NET Framework standalone executable + - **NuGetUtility/**: Core utility library + - **NuGetLicense/**: License validation and processing library + - **FileLicenseMatcher/**: License file matching library +- **tests/**: Test projects + - **NuGetUtility.Test/**: Core utility tests + - **NuGetLicense.Test/**: License validation tests + - **FileLicenseMatcher.Test/**: File license matcher tests + - **NuGetUtility.UrlToLicenseMapping.Test/**: URL to license mapping tests + - **targets/**: Test target projects with various configurations +- **integration/**: Integration test projects +- **docs/**: Documentation files +- **.github/workflows/**: CI/CD workflows + +## Building the Project + +### Prerequisites + +- .NET SDK 8.0, 9.0, and 10.0 +- MSBuild (for .NET Framework and C++ projects on Windows) + +### Build Commands + +```bash +# Restore dependencies +dotnet restore + +# Build the entire solution +dotnet build --configuration Release --no-restore + +# Build a specific project +dotnet build ./src/NuGetLicenseCore/NuGetLicenseCore.csproj --configuration Release + +# On Windows with MSBuild +msbuild -t:rebuild -restore -p:RestorePackagesConfig=true -property:Configuration=Release +``` + +## Testing the Project + +### Running Tests + +```bash +# Run all tests +dotnet test --configuration Release --no-restore + +# Run specific test project +dotnet test --project ./tests/NuGetUtility.Test/NuGetUtility.Test.csproj --configuration Release + +# Run tests for a specific framework +dotnet test --project ./tests/NuGetUtility.Test/NuGetUtility.Test.csproj --configuration Release -f net10.0 +``` + +### Test Organization + +- Tests follow the pattern `ClassName.Test.cs` for testing `ClassName.cs` +- Use xUnit as the testing framework +- Test projects include both unit tests and integration tests + +## Code Formatting and Linting + +```bash +# Check code formatting (does not modify files) +dotnet format --verify-no-changes + +# Format code +dotnet format +``` + +## Coding Conventions + +### C# Code Style + +- **Indentation**: 4 spaces (never tabs) +- **Line endings**: CRLF for most files, LF for shell scripts +- **File header**: All C# files must include the license header: + ```csharp + // Licensed to the projects contributors. + // The license conditions are provided in the LICENSE file located in the project root + ``` +- **Namespaces**: Use block-scoped namespaces (not file-scoped) +- **Braces**: Opening braces on new lines (Allman style) +- **Using directives**: Outside namespace, sorted with System directives first + +### Naming Conventions + +- **Private/internal fields**: `_camelCase` with underscore prefix +- **Static private fields**: `s_camelCase` with `s_` prefix +- **Constants**: `PascalCase` +- **Public members**: `PascalCase` +- **Local variables**: `camelCase` + +### Code Quality + +- Avoid `this.` qualifier for members (except when necessary for disambiguation) +- Use explicit types instead of `var` for built-in types +- Use modern C# features: pattern matching, null propagation, coalesce expressions +- Prefer switch expressions over switch statements +- Use expression-bodied members where appropriate +- Always use braces for control flow statements + +### XML Documentation + +- Public APIs should have XML documentation comments +- Use ``, ``, ``, `` tags as appropriate + +## Common Patterns in This Codebase + +- License validation uses expression parsing and evaluation +- Package information is read from `project.assets.json` files generated by `dotnet restore` +- The tool supports multiple output formats: Table, Markdown, JSON, and JsonPretty +- Configuration files use JSON format for mappings, overrides, and filters + +## Dependencies + +- Avoid adding new NuGet dependencies unless absolutely necessary +- When adding dependencies, ensure they work with all target frameworks (net8.0, net9.0, net10.0, net472) +- Consider cross-platform compatibility when adding dependencies + +## Multi-targeting Considerations + +- The project targets multiple .NET versions including .NET Framework 4.7.2 +- Test code changes on all target frameworks when modifying core functionality +- Be aware of API availability differences between .NET Framework and .NET Core/5+ + +## GitHub Actions Workflows + +- `.github/workflows/action.yml`: Main CI workflow that runs tests, code formatting checks, and license validation +- `.github/workflows/release.yml`: Release workflow for publishing packages +- The CI validates against multiple frameworks: net8.0, net9.0, net10.0, and net472 + +## Additional Notes + +- The project includes both managed (.NET) and native (C++) project support +- Windows-specific paths are handled specially in some integration tests +- The tool does NOT restore NuGet packages itself - it reads from existing `project.assets.json` files From 777fa7b4a3255827a1a9b4c0aa0fabf6f4c273db Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 20:48:58 +0000 Subject: [PATCH 3/4] Improve Copilot instructions with clarifications on SDK version and naming conventions Co-authored-by: sensslen <3428860+sensslen@users.noreply.github.com> --- .github/copilot-instructions.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index f6c508f5..2260ba94 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -26,7 +26,8 @@ This repository contains **nuget-license**, a .NET tool for analyzing, printing, ### Prerequisites -- .NET SDK 8.0, 9.0, and 10.0 +- .NET SDK 10.0.102 or later (with rollForward to support minor versions) + - The project also targets net8.0 and net9.0, which require their respective SDKs - MSBuild (for .NET Framework and C++ projects on Windows) ### Build Commands @@ -94,7 +95,9 @@ dotnet format ### Naming Conventions - **Private/internal fields**: `_camelCase` with underscore prefix -- **Static private fields**: `s_camelCase` with `s_` prefix +- **Static private/internal fields**: `s_camelCase` with `s_` prefix (preferred for new code) + - Note: Some ported code (e.g., FileLicenseMatcher from Java SPDX library) uses `UPPER_CASE` for static readonly fields +- **Public static readonly fields**: `UPPER_CASE` (especially for constants and patterns in ported code) - **Constants**: `PascalCase` - **Public members**: `PascalCase` - **Local variables**: `camelCase` From 7ee15190233394fd4a63b1e93b72c661d5c65e9f Mon Sep 17 00:00:00 2001 From: Simon Ensslen Date: Thu, 15 Jan 2026 21:53:42 +0100 Subject: [PATCH 4/4] Update .NET SDK version in instructions --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 2260ba94..5cd740a0 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -26,7 +26,7 @@ This repository contains **nuget-license**, a .NET tool for analyzing, printing, ### Prerequisites -- .NET SDK 10.0.102 or later (with rollForward to support minor versions) +- .NET SDK 10.0.101 or later (with rollForward to support minor versions) - The project also targets net8.0 and net9.0, which require their respective SDKs - MSBuild (for .NET Framework and C++ projects on Windows)