
Build And Test
Run the correct dotnet restore, build, format, and unit-test commands when changing Microsoft Agent Framework .NET packages.
Overview
Build-and-test is an agent skill for the Build phase that runs restore, build, format, and filtered unit tests for Agent Framework .NET packages.
Install
npx skills add https://github.com/microsoft/agent-framework --skill build-and-testWhat is this skill?
- Documents dotnet restore, build, test, and format from the dotnet/ directory with --tl:off
- Scoped commands for Microsoft.Agents.AI.<Package> builds and matching UnitTests projects
- Single-test filter-query pattern with assembly, namespace, class, and method wildcards
- Clarifies only UnitTest projects run locally; IntegrationTests need external dependencies
- Points to project-structure skill for monorepo layout context
Adoption & trust: 40 installs on skills.sh; 11.2k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You changed Agent Framework .NET code and need the right isolated build and test commands without running integration tests that require external deps.
Who is it for?
Contributors or fork maintainers hacking Microsoft Agent Framework who want agents to follow official build and test rituals.
Skip if: Greenfield apps that only consume NuGet packages and never clone the Agent Framework repo.
When should I use this skill?
Verifying or testing changes in the Agent Framework repository with dotnet restore, build, test, or format.
What do I get? / Deliverables
Your agent executes documented dotnet workflows and targeted test filters so you know UnitTests pass before you commit or open a PR.
- Successful package build output
- Unit test run results
- Formatted source per dotnet format
Recommended Skills
Journey fit
Canonical shelf is Build because the skill exists to verify agent-framework code changes compile and pass unit tests before wider release. Agent-tooling is the right shelf: it documents repo-specific workflows for Microsoft.Agents.AI packages contributors touch daily.
How it compares
Repo contributor workflow skill—not a substitute for generic xUnit or .NET CI templates outside this monorepo.
Common Questions / FAQ
Who is build-and-test for?
Developers cloning or contributing to the Microsoft Agent Framework repository who need reliable dotnet build and unit-test commands for Microsoft.Agents.AI packages.
When should I use build-and-test?
During Build when verifying or testing changes to Agent Framework .NET source, formatting a package, or running one failing unit test with a filter-query.
Is build-and-test safe to install?
It instructs standard dotnet CLI on your machine; review the Security Audits panel on this page and only run commands inside a repo you trust.
SKILL.md
READMESKILL.md - Build And Test
- Only **UnitTest** projects need to be run locally; IntegrationTests require external dependencies. - See `../project-structure/SKILL.md` for project structure details. ## Build, Test, and Lint Commands ```bash # From dotnet/ directory dotnet restore --tl:off # Restore dependencies for all projects dotnet build --tl:off # Build all projects dotnet test # Run all tests dotnet format # Auto-fix formatting for all projects # Build/test/format a specific project (preferred for isolated/internal changes) dotnet build src/Microsoft.Agents.AI.<Package> --tl:off dotnet test --project tests/Microsoft.Agents.AI.<Package>.UnitTests dotnet format src/Microsoft.Agents.AI.<Package> # Run a single test # Replace the filter values with the appropriate assembly, namespace, class, and method names for the test you want to run and use * as a wildcard elsewhere, e.g. "/*/*/HttpClientTests/GetAsync_ReturnsSuccessStatusCode" # Use `--ignore-exit-code 8` to avoid failing the build when no tests are found for some projects dotnet test --filter-query "/<assemblyFilter>/<namespaceFilter>/<classFilter>/<methodFilter>" --ignore-exit-code 8 # Run unit tests only # Use `--ignore-exit-code 8` to avoid failing the build when no tests are found for integration test projects dotnet test --filter-query "/*UnitTests*/*/*/*" --ignore-exit-code 8 ``` Use `--tl:off` when building to avoid flickering when running commands in the agent. ## Speeding Up Builds and Testing The full solution is large. Use these shortcuts: | Change type | What to do | |-------------|------------| | Isolated/Internal logic | Build only the affected project and its `*.UnitTests` project. Fix issues, then build the full solution and run all unit tests. | | Public API surface | Build the full solution and run all unit tests immediately. | Example: Building a single code project for all target frameworks ```bash # From dotnet/ directory dotnet build ./src/Microsoft.Agents.AI.Abstractions ``` Example: Building a single code project for just .NET 10. ```bash # From dotnet/ directory dotnet build ./src/Microsoft.Agents.AI.Abstractions -f net10.0 ``` Example: Running tests for a single project using .NET 10. ```bash # From dotnet/ directory dotnet test --project ./tests/Microsoft.Agents.AI.Abstractions.UnitTests -f net10.0 ``` Example: Running a single test in a specific project using .NET 10. Provide the full namespace, class name, and method name for the test you want to run: ```bash # From dotnet/ directory dotnet test --project ./tests/Microsoft.Agents.AI.Abstractions.UnitTests -f net10.0 --filter-query "/*/Microsoft.Agents.AI.Abstractions.UnitTests/AgentRunOptionsTests/CloningConstructorCopiesProperties" ``` ### Multi-target framework tip Most projects target multiple .NET frameworks. If the affected code does **not** use `#if` directives for framework-specific logic, pass `-f net10.0` to speed up building and testing. ### Package Restore tip `dotnet build` will try and restore packages for all projects on each build, which can be slow. Unless packages have been changed, or it's the first time building the solution, add `--no-restore` to the build command to skip this step and speed up builds. Just remember to run `dotnet restore` after pulling changes, making changes to project references, or when building for the first time. ### Testing on Linux tip Unit tests target both .NET Framework as well as .NET Core. When running on Linux, only the .NET Core tests can be run, as .NET Framework is not supported on Linux. To run only the .NET Core tests, use the `-f net10.0` option with `dotnet test`. ### Microsoft Testing Platform (MTP) Tests use the [Microsoft Testing Platform](https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-intro) via xUnit v3. Key differences fr