|
| 1 | +# NuGet.Client agent instructions |
| 2 | + |
| 3 | +NuGet.Client is the .NET codebase for NuGet tooling and libraries used by |
| 4 | +Visual Studio, the .NET CLI, MSBuild, and `nuget.exe`. |
| 5 | + |
| 6 | +## Scope and precedence |
| 7 | + |
| 8 | +- These instructions apply to the entire repository. |
| 9 | +- Read and follow the nearest nested `AGENTS.md` for the files being changed. |
| 10 | +- Preserve user changes and do not modify unrelated files. |
| 11 | +- Prefer the smallest complete change that addresses the root cause. |
| 12 | + |
| 13 | +## Before making changes |
| 14 | + |
| 15 | +1. Inspect the affected projects and tests, and search for existing patterns |
| 16 | + before adding new helpers or abstractions. |
| 17 | +2. Read the guidance relevant to the task: |
| 18 | + |
| 19 | + | Change | Required guidance | |
| 20 | + | --- | --- | |
| 21 | + | New feature or behavior change | [`docs/feature-guide.md`](docs/feature-guide.md) | |
| 22 | + | Public API change | [`docs/nuget-sdk.md`](docs/nuget-sdk.md) | |
| 23 | + | C# implementation | [`.github/agent_docs/csharp.md`](.github/agent_docs/csharp.md) | |
| 24 | + | Localization | [`.github/agent_docs/localization.md`](.github/agent_docs/localization.md) | |
| 25 | + | Nullable migration | [`.github/agent_docs/nullable-migrations.md`](.github/agent_docs/nullable-migrations.md) | |
| 26 | + | Performance measurement | [`.github/agent_docs/benchmarking.md`](.github/agent_docs/benchmarking.md) | |
| 27 | + | Dependency update | [`docs/updating-packages.md`](docs/updating-packages.md) | |
| 28 | + | Branch or pull request | [`.github/agent_docs/git-workflow.md`](.github/agent_docs/git-workflow.md) | |
| 29 | + |
| 30 | +3. Use [`CONTRIBUTING.md`](CONTRIBUTING.md) as the index for broader |
| 31 | + development documentation. |
| 32 | + |
| 33 | +## Implementation rules |
| 34 | + |
| 35 | +- Follow existing project conventions and reuse established test utilities. |
| 36 | +- Add or update tests when behavior changes. |
| 37 | +- Consider all affected NuGet surfaces: Visual Studio, `dotnet`, MSBuild, |
| 38 | + `nuget.exe`, restore, and pack. Change only the surfaces relevant to the task. |
| 39 | +- Follow `SdkAnalysisLevel` and feature-configuration requirements for new |
| 40 | + behavior. |
| 41 | +- Keep public API files accurate when changing public surface area. |
| 42 | +- Declare package versions in `Directory.Packages.props`; project |
| 43 | + `PackageReference` items must be versionless. |
| 44 | +- Do not edit generated localization `.xlf` files manually. Edit the `.resx` |
| 45 | + and build the owning project to regenerate dependent files. |
| 46 | + |
| 47 | +## Build and test |
| 48 | + |
| 49 | +- Configure once before the first build: |
| 50 | + - Windows: `.\configure.ps1` |
| 51 | + - Linux or macOS: `. ./configure.sh` |
| 52 | +- Build only the projects relevant to the change with `dotnet` or `msbuild`. |
| 53 | +- On Linux and macOS, do not build `NuGet.sln`; it contains Windows-only |
| 54 | + projects. Use `./build.sh` when a broader cross-platform build is needed. |
| 55 | +- Run the smallest relevant tests with `dotnet test`, using `--filter` when |
| 56 | + possible. |
| 57 | +- Before submitting a pull request, run: |
| 58 | + `dotnet format whitespace --verify-no-changes NuGet.sln` |
| 59 | + |
| 60 | +## Completion |
| 61 | + |
| 62 | +- Ensure source, tests, public API files, generated artifacts, and directly |
| 63 | + related documentation remain consistent. |
| 64 | +- Report the files changed and the exact validation performed. |
0 commit comments