This repository contains dotnet-exec, a .NET CLI tool for executing C# code and script files without requiring a project file, plus the ReferenceResolver library used for package, file, folder, framework, and project references.
Treat this file as the repository-level operating guide for coding agents. Keep changes targeted, preserve existing conventions, and prefer updating tests and docs together with behavior changes.
src/dotnet-exec: main CLI applicationsrc/ReferenceResolver: reusable reference resolution librarytests/UnitTest: fast unit teststests/IntegrationTest: integration tests and sample scriptstests/PerformanceTest: benchmarks and performance experimentsdocs: end-user documentation and release notesbuild: build orchestration used by CI and local packaging_site,artifacts,TestResults: generated output; do not hand-edit unless the task is specifically about generated artifacts
Prefer rg for file discovery and text search.
Primary commands from the repository root:
dotnet restore .\dotnet-exec.slnx
dotnet build .\dotnet-exec.slnx
dotnet test .\tests\UnitTest\UnitTest.csproj
dotnet test .\tests\IntegrationTest\IntegrationTest.csproj
.\build.ps1 --target=testCross-platform build entry points:
.\build.ps1 --target=testbash build.sh --target=buildUse focused test runs while iterating:
dotnet test .\tests\UnitTest\UnitTest.csproj --filter "FullyQualifiedName~CodeExecutor"
dotnet test .\tests\IntegrationTest\IntegrationTest.csproj --filter "FullyQualifiedName~NuGetReferenceResolverTest"When a change affects packaging or CLI behavior, prefer running the relevant build script target in addition to direct dotnet test commands.
The main GitHub Actions workflow is .github/workflows/dotnet.yml.
- Windows CI runs
.\build.ps1 --target=test - Linux and macOS CI run
bash build.sh --target=build - The workflow installs .NET
10.xand11.x
Before finishing substantial code changes, run the closest equivalent local verification for the area you touched.
Follow .editorconfig.
- Use spaces for indentation
- Use file-scoped namespaces in C#
- Prefer
varwhere the type is apparent - Keep line length within 120 where practical
- Preserve the file header in C# files
- Do not reorder using directives to force
System.*first; this repo disables that preference
Match the surrounding style before introducing a new pattern. Do not perform opportunistic style churn in unrelated files.
- Add or update tests for behavior changes
- Prefer unit tests for isolated logic and integration tests for end-to-end CLI/reference-resolution behavior
- Many integration tests rely on files under
tests/IntegrationTest/CodeSamples; keep samples minimal and purposeful - If you change command-line parsing, script transformation, compilation, or reference resolution, verify with the relevant unit and integration tests
When public behavior, commands, or supported scenarios change, update the relevant documentation:
README.mdfor main usage and quick-start guidanceREADME.zh.mdwhen the change affects mirrored top-level documentationdocs/articles/en/*anddocs/articles/zh/*for deeper guidesdocs/ReleaseNotes.mdfor release-note-worthy behavior changes
- Do not hand-edit generated outputs in
_site,artifacts, orTestResultsunless explicitly required - Do not upgrade package versions, target frameworks, or build infrastructure unless the task requires it
- Keep changes scoped; avoid broad renames or cleanup-only edits mixed into feature or bug-fix work
- Never revert user changes you did not make
- Read the relevant source files and tests before editing.
- Make the smallest coherent change that solves the task.
- Run targeted verification locally.
- Update tests and docs when behavior changes.
- Summarize what changed, what you verified, and any remaining gaps.
Follow the Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Common types:
| Type | When to use |
|---|---|
feat |
A new feature |
fix |
A bug fix |
docs |
Documentation changes only |
style |
Formatting changes (no logic change) |
refactor |
Code restructuring (no feature or fix) |
test |
Adding or updating tests |
chore |
Build process, dependency updates, tooling |
perf |
Performance improvements |
ci |
CI/CD workflow changes |
Examples:
feat(exec): support .rest file extension in exec command
fix(middleware): handle null response body in logging middleware
docs: update installation instructions in README
chore: bump WeihanLi.Common dependency
- Use the imperative mood in the description ("add" not "added")
- Keep the first line at 72 characters or fewer
- Reference issues in the footer:
Fixes #123orCloses #123