Files
templates-dotnet/.github/instructions/msbuild.instructions.md
T
akritikos 8e3b5ebdfc Adds project guidelines and conventions for Github Copilot
Introduces detailed instructions for ASP.NET API, C#, Docker, MSBuild,
testing, and library creation. These guidelines aim to standardize
development practices and improve code quality across the project.
2026-04-16 15:56:15 +03:00

40 lines
1.1 KiB
Markdown

---
description: "Use when editing MSBuild files (.csproj, .props, .targets). Covers central package management, artifacts layout, and property inheritance."
applyTo: "**/*.{csproj,props,targets}"
---
# MSBuild Conventions
## Central Package Management
All package versions are declared in `Directory.Packages.props` at the repo root. In `.csproj` files:
```xml
<!-- Correct -->
<PackageReference Include="Newtonsoft.Json" />
<!-- Wrong — never specify Version -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
```
To add or update a version, edit `Directory.Packages.props`:
```xml
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
```
## Properties Set Centrally (Do Not Override)
These are configured in the root `Directory.Build.props` — do **not** set them in individual projects:
`LangVersion`, `Nullable`, `ImplicitUsings`.
## InternalsVisibleTo
Handled automatically via `<InternalsVisibleToSuffix>` in the root props. Default suffixes are `.Tests` and `Tests`. To add custom visibility:
<parameter name="newString">```xml
<ItemGroup>
<InternalsVisibleTo Include="MyProject.IntegrationTests" />
</ItemGroup>
```