Skip to content

Commit d5de993

Browse files
authored
Merge pull request #1259 from dotnet/copilot/fix-5d206f1b-64e8-46e7-96c6-385f294f84d1
Update copilot instructions with comprehensive guidance for shallow clone environment
1 parent d3ea637 commit d5de993

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

.github/copilot-instructions.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,55 @@
55
* Review the `CONTRIBUTING.md` file for instructions to build and test the software.
66
* Set the `NBGV_GitEngine` environment variable to `Disabled` before running any `dotnet` or `msbuild` commands.
77

8+
## Environment Setup and Shallow Clone Workaround
9+
10+
This repository uses Nerdbank.GitVersioning which depends on git history for version calculation. Since GitHub Copilot Coding Agent operates on shallow clones, you MUST set the following environment variable before running any build commands:
11+
12+
```bash
13+
export NBGV_GitEngine=Disabled
14+
```
15+
16+
**Important**: The environment variable name and value are case-sensitive. This setting:
17+
- Removes access to git history during builds
18+
- Allows builds to succeed in shallow clone environments
19+
- Results in incorrect version stamps (expected in Copilot environment)
20+
- Still generates the `ThisAssembly` class but with fewer properties
21+
22+
## Building and Testing
23+
24+
### Initial Setup
25+
1. Run the initialization script: `./init.ps1` or `pwsh ./init.ps1`
26+
2. This downloads NuGet.exe, restores packages, and sets up the build environment
27+
28+
### Building
29+
* For a complete build: `./build.ps1` or `pwsh ./build.ps1`
30+
* Ensure `NBGV_GitEngine=Disabled` is set before building
31+
* The build process first creates NuGet packages, then builds NPM packages
32+
33+
### Testing
34+
* Run all tests: `dotnet test --filter "TestCategory!=FailsInCloudTest"`
35+
* The filter excludes unstable tests that are known to fail in cloud environments
36+
* Tests use the Xunit testing framework
37+
* All tests should pass when `NBGV_GitEngine=Disabled` is set
38+
839
## Software Design
940

1041
* Design APIs to be highly testable, and all functionality should be tested.
1142
* Avoid introducing binary breaking changes in public APIs of projects under `src` unless their project files have `IsPackable` set to `false`.
43+
* Follow existing patterns in the codebase for consistency.
1244

13-
## Testing
45+
## Testing Guidelines
1446

1547
* There should generally be one test project (under the `test` directory) per shipping project (under the `src` directory). Test projects are named after the project being tested with a `.Test` suffix.
1648
* Tests should use the Xunit testing framework.
1749
* Some tests are known to be unstable. When running tests, you should skip the unstable ones by running `dotnet test --filter "TestCategory!=FailsInCloudTest"`.
50+
* Write tests that cover both happy path and edge cases.
51+
* Ensure all new functionality is covered by tests.
1852

19-
## Coding style
53+
## Coding Style
2054

2155
* Honor StyleCop rules and fix any reported build warnings *after* getting tests to pass.
2256
* In C# files, use namespace *statements* instead of namespace *blocks* for all new files.
2357
* Add API doc comments to all new public and internal members.
58+
* Follow existing code formatting and naming conventions in the repository.
59+
* Use meaningful variable and method names that clearly express intent.

0 commit comments

Comments
 (0)