Use the instructions from the main branch if available: @dotnet/sdk/files/.github/copilot-instructions.md
If the instructions from main are not available, use the following as a fallback:
Coding Style and Changes:
- Code should match the style of the file it's in.
- Changes should be minimal to resolve a problem in a clean way.
- User-visible changes to behavior should be considered carefully before committing. They should always be flagged.
- Only edit the files that are necessary to address the specific issue. Do not run
dotnet formator make formatting changes to additional files. - Prefer using file-based namespaces for new code.
- Do not allow unused
usingdirectives to be committed. - Use
#if NETblocks for .NET Core specific code, and#if NETFRAMEWORKfor .NET Framework specific code.
Testing:
- Large changes should always include test changes.
- The Skip parameter of the Fact attribute to point to the specific issue link.
- To run tests in this repo:
- Use the repo-local dotnet instance:
./.dotnet/dotnet - For MSTest-style projects:
dotnet test path/to/project.csproj --filter "FullyQualifiedName~TestName" - For XUnit test assemblies:
dotnet exec artifacts/bin/redist/Debug/TestAssembly.dll -method "*TestMethodName*" - Examples:
dotnet test test/dotnet.Tests/dotnet.Tests.csproj --filter "Name~ItShowsTheAppropriateMessageToTheUser"dotnet exec artifacts/bin/redist/Debug/dotnet.Tests.dll -method "*ItShowsTheAppropriateMessageToTheUser*"
- Use the repo-local dotnet instance:
- To test CLI command changes:
- Build the redist SDK:
./build.shfrom repo root - Create a dogfood environment:
source eng/dogfood.sh - Test commands in the dogfood shell (e.g.,
dnx --help,dotnet tool install --help) - The dogfood script sets up PATH and environment to use the newly built SDK
- Build the redist SDK:
- For fast incremental iteration on specific projects (e.g.,
dotnet,Microsoft.DotNet.ProjectTools), useeng/deploy-dogfood.ps1instead of a fullbuild.cmd. It builds only the specified projects and copies DLLs into the redist layout (~30s vs ~5min). Usage:.\eng\deploy-dogfood.ps1 -Projects dotnet,Microsoft.DotNet.ProjectTools
Output Considerations:
- When considering how output should look, solicit advice from baronfel.
Localization:
- Avoid modifying .xlf files and instead prompt the user to update them using the
/t:UpdateXlftarget on MSBuild. Correctly automatically modified .xlf files have elements with stateneeds-review-translationornew. - Consider localizing strings in .resx files when possible.
Documentation:
- Do not manually edit files under documentation/manpages/sdk as these are generated based on documentation and should not be manually modified.
External Dependencies:
- Changes that require modifications to the dotnet/templating repository (Microsoft.TemplateEngine packages) should be made directly in that repository, not worked around in this repo.
- The dotnet/templating repository owns the TemplateEngine.Edge, TemplateEngine.Abstractions, and related packages.
- If a change requires updates to template engine behavior or formatting (e.g., DisplayName properties), file an issue in dotnet/templating and make the changes there rather than adding workarounds in this SDK repository.