Official agent skill

Migrate Xunit To Xunit V3

by microsoft in microsoft/testfx

Migrates .NET test projects from xUnit.net v2 to xUnit.net v3.

OfficialMITAuto-check passedTesting & QA

Install Migrate Xunit To Xunit V3

skills CLI
$ npx skills add microsoft/testfx --skill migrate-xunit-to-xunit-v3 -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/testfx migrate-xunit-to-xunit-v3 --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/migrate-xunit-to-xunit-v3 .claude/skills/migrate-xunit-to-xunit-v3 && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
migrate-xunit-to-xunit-v3
GitHub stars
1k
Token cost
~2.2k tokens
SKILL.md length
867 words
Files
1
Skills in repo
50
Repo updated
First seen
Licence
MIT

At a glance

Migrates .NET test projects from xUnit.net v2 to xUnit.net v3.

  • Works in 12 steps: Identify xUnit.net projects and verify… → Update package references → Set OutputType to Exe → …
  • : upgrading xunit to xunit.v3
  • SKILL.md covers When to Use, When Not to Use, Inputs and Workflow
  • Calls dotnet

What it does

Migrate Xunit To Xunit V3 is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Migrates .NET test projects from xUnit.net v2 to xUnit.net v3. USE FOR: upgrading xunit to xunit.v3. DO NOT USE FOR: migrating between test frameworks (MSTest/NUnit to xUnit.net), migrating from VSTest to Microsoft.Testing.Platform (use migrate-vstest-to-mtp). For xUnit v3 MTP filter syntax (--filter-class, --filter-trait, --filter-query), also load migrate-vstest-to-mtp.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with .NET. The repository describes itself as: This repository holds the source code of Microsoft.Testing.Platform (MTP), a lightweight alternative to VSTest, as well as MSTest adapter and framework. The licence is MIT.

When your agent uses it

  • : upgrading xunit to xunit.v3
  • : migrating between test frameworks (MSTest/NUnit to xUnit.net)
  • Migrating from VSTest to Microsoft.Testing.Platform (use migrate-vstest-to-mtp)

Example prompts

  • “Use the migrate-xunit-to-xunit-v3 skill to migrate .NET test projects from xUnit.net v2 to xUnit.net v3”
  • “/migrate-xunit-to-xunit-v3”

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. Identify xUnit.net projects and verify compatibility
  2. Update package references
  3. Set OutputType to Exe
  4. Configure test platform
  5. Remove Xunit.Abstractions usings
  6. Address async void breaking change (if applicable)
  7. Address breaking change of attributes (if applicable)
  8. Inheriting from FactAttribute or TheoryAttribute (if applicable)
  9. Inheriting from BeforeAfterTestAttribute (if applicable)
  10. Address new xUnit analyzer warnings (if applicable)
  11. Migrate Xunit.SkippableFact (if applicable)
  12. Update companion packages (if applicable)

What it can do on your machine

Read from SKILL.md and the folder at commit 19d717a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • dotnet

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Migrate Xunit To Xunit V3 loads about 2.2k tokens when it runs. Until then it costs about 100 tokens; SKILL.md has 867 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/testfx at commit 19d717a, republished under its MIT licence (© microsoft). 867 words, ~2,226 tokens.

Download SKILL.mdSave it as .claude/skills/migrate-xunit-to-xunit-v3/SKILL.md (or your agent's skills folder).
name
migrate-xunit-to-xunit-v3
description
Migrates .NET test projects from xUnit.net v2 to xUnit.net v3. USE FOR: upgrading xunit to xunit.v3. DO NOT USE FOR: migrating between test frameworks (MSTest/NUnit to xUnit.net), migrating from VSTest to Microsoft.Testing.Platform (use migrate-vstest-to-mtp). For xUnit v3 MTP filter syntax (--filter-class, --filter-trait, --filter-query), also load migrate-vstest-to-mtp.
license
MIT

xunit.v3 Migration

Migrate .NET test projects from xUnit.net v2 to xUnit.net v3. The outcome is a solution where all test projects reference xunit.v3.* packages, compiles cleanly, and all tests pass with the same results as before migration.

When to Use

  • Upgrading test projects from xunit (v2) packages to xunit.v3
  • Resolving compilation errors after updating xunit package references to v3

When Not to Use

  • Migrating between test frameworks (e.g., MSTest or NUnit to xUnit.net) — different effort entirely
  • Migrating from VSTest to Microsoft.Testing.Platform — use migrate-vstest-to-mtp
  • The projects already reference xunit.v3 — migration is done

Inputs

InputRequiredDescription
Test project or solutionYesThe .NET project or solution containing xUnit.net v2 test projects

Workflow

Commit strategy: Commit after each major step so the migration is reviewable and bisectable. Separate project file changes from code changes.

Prioritization: Steps 1-5 are required for every migration. Steps 6-12 are conditional — only apply the ones relevant to the project's code patterns. Skip steps that don't apply.

Step 1: Identify xUnit.net projects and verify compatibility

Search for test projects referencing xUnit.net v2 packages:

  • xunit
  • xunit.abstractions
  • xunit.assert
  • xunit.core
  • xunit.extensibility.core
  • xunit.extensibility.execution
  • xunit.runner.visualstudio

Make sure to check the package references in project files, MSBuild props and targets files, like Directory.Build.props, Directory.Build.targets, and Directory.Packages.props.

Verify target framework compatibility: xUnit.net v3 requires .NET 8+ or .NET Framework 4.7.2+. For test library projects, .NET Standard 2.0 is also supported. If any test projects have non-compatible target frameworks, STOP here — tell the user to upgrade the target framework first. Also verify the project uses SDK-style format.

Step 2: Update package references
  1. Update any PackageReference or PackageVersion items for the new package names, based on the following mapping:

    • xunit → xunit.v3
    • xunit.abstractions → Remove entirely
    • xunit.assert → xunit.v3.assert
    • xunit.core → xunit.v3.core
    • xunit.extensibility.core and xunit.extensibility.execution → xunit.v3.extensibility.core (if both are referenced in a project consolidate to only a single entry as the two packages are merged)
  2. Update all xunit.v3.* packages to the latest correct version available on NuGet. Also update xunit.runner.visualstudio to the latest version.

Step 3: Set OutputType to Exe

In each test project (excluding test library projects), set OutputType to Exe in the project file:

xml
<PropertyGroup>
  <OutputType>Exe</OutputType>
</PropertyGroup>

Depending on the solution in hand, there might be a centralized place where this can be added. For example:

  • If all test projects share (or can share) a common Directory.Build.props, add the <OutputType>Exe</OutputType> property there. Note that the OutputType should not be added to Directory.Build.targets.
  • If all test projects share a name pattern (e.g., *.Tests.csproj), add a conditional property group in Directory.Build.props that applies only to those projects, like <OutputType Condition="$(MSBuildProjectName.EndsWith('.Tests'))">Exe</OutputType>. Adjust the condition as needed to target only test projects.
  • Otherwise, add the <OutputType>Exe</OutputType> property to each test project file individually.
Step 4: Configure test platform

Preserve the same test platform that was used with xUnit.net v2. xUnit.net v2 always uses VSTest except if the project used YTest.MTP.XUnit2.

  • If the project had a reference to YTest.MTP.XUnit2:
    • Remove the reference to YTest.MTP.XUnit2 completely.
    • Add <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner> to Directory.Build.props under an unconditional PropertyGroup.
  • If the project did NOT reference YTest.MTP.XUnit2 (the common case):
    • Add <IsTestingPlatformApplication>false</IsTestingPlatformApplication> to Directory.Build.props under an unconditional PropertyGroup. If Directory.Build.props doesn't exist, create it. This keeps the project on VSTest.
Show full SKILL.md (349 more words)Show less
Step 5: Remove Xunit.Abstractions usings

Find any using Xunit.Abstractions; directives in C# files and remove them completely.

Step 6: Address async void breaking change (if applicable)

In xUnit.net v3, async void test methods are no longer supported and will fail to compile. Search for any test methods declared with async void and change them to async Task. Test methods can be identified via the [Fact] or [Theory] attributes or other test attributes.

Step 7: Address breaking change of attributes (if applicable)

In xUnit.net v3, some attributes were updated so that they accept a System.Type instead of two strings (fully qualified type name and assembly name). These attributes are:

  • CollectionBehaviorAttribute
  • TestCaseOrdererAttribute
  • TestCollectionOrdererAttribute
  • TestFrameworkAttribute

For example, [assembly: CollectionBehavior("MyNamespace.MyCollectionFactory", "MyAssembly")] must be converted to [assembly: CollectionBehavior(typeof(MyNamespace.MyCollectionFactory))].

Step 8: Inheriting from FactAttribute or TheoryAttribute (if applicable)

Identify if there are any custom attributes that inherit from FactAttribute or TheoryAttribute. These custom user-defined attributes must now provide source information. For example, if the attribute looked like this:

csharp
internal sealed class MyFactAttribute : FactAttribute
{
    public MyFactAttribute()
    {
    }
}

it must be changed to this:

csharp
internal sealed class MyFactAttribute : FactAttribute
{
    public MyFactAttribute(
        [CallerFilePath] string? sourceFilePath = null,
        [CallerLineNumber] int sourceLineNumber = -1
    ) : base(sourceFilePath, sourceLineNumber)
    {
    }
}
Step 9: Inheriting from BeforeAfterTestAttribute (if applicable)

Identify if there are any custom attributes that inherit from BeforeAfterTestAttribute. These custom user-defined attributes must update their method signatures. Previously, they would have Before/After overrides that look like this:

csharp
    public override void Before(MethodInfo methodUnderTest)
    {
        // Possibly some custom logic here
        base.Before(methodUnderTest);
        // Possibly some custom logic here
    }

    public override void After(MethodInfo methodUnderTest)
    {
        // Possibly some custom logic here
        base.After(methodUnderTest);
        // Possibly some custom logic here
    }

it must be changed to this:

csharp
    public override void Before(MethodInfo methodUnderTest, IXunitTest test)
    {
        // Possibly some custom logic here
        base.Before(methodUnderTest, test);
        // Possibly some custom logic here
    }

    public override void After(MethodInfo methodUnderTest, IXunitTest test)
    {
        // Possibly some custom logic here
        base.After(methodUnderTest, test);
        // Possibly some custom logic here
    }
Step 10: Address new xUnit analyzer warnings (if applicable)

xunit.v3 introduced new analyzer warnings. The most notable is xUnit1051 (use TestContext.Current.CancellationToken for methods accepting CancellationToken). Address these if present.

Step 11: Migrate Xunit.SkippableFact (if applicable)

If there are any package references to Xunit.SkippableFact, remove all these package references entirely.

Then, follow these steps to eliminate usages of APIs coming from the removed package reference:

  • Update any SkippableFact attribute to the regular Fact attribute.
  • Update any SkippableTheory attribute to the regular Theory attribute.
  • Change Skip.If method calls to Assert.SkipWhen.
  • Change Skip.IfNot method calls to Assert.SkipUnless.
Step 12: Update companion packages (if applicable)
  • Xunit.Combinatorial 1.x → latest 2.x
  • Xunit.StaFact 1.x → latest 3.x
Step 13: Build and verify

Build the solution and fix any remaining compilation errors. Run dotnet test to verify all tests pass with the same results as before migration.

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/migrate-xunit-to-xunit-v3 of microsoft/testfx.

Open the folder on GitHubat commit 19d717a

Compare with similar skills

Migrate Xunit To Xunit V3 next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Migrate Xunit To Xunit V3 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Migrate Xunit To Xunit V3 this skillmicrosoft/testfx1k—~2.2kAutomated safety check: PassMIT
New Event Sourceaws/aws-lambda-dotnet1.7k—~3kAutomated safety check: PassApache-2.0
ScottPlot Test RunnerScottPlot/ScottPlot6.8k—~308Automated safety check: PassMIT
Aspire Integration TestingDevBetterCom/DevBetterWeb1572 repos~2.3kAutomated safety check: PassNone
Vstest Build Testmicrosoft/vstest969—~1.9kAutomated safety check: PassMIT
Coverage Analysisrunceel/ReactiveProperty944—~5.9kAutomated safety check: WarnMIT

Similar skills

  • New Event Source

    aws/aws-lambda-dotnet

    Official

    Add a new AWS event source attribute (e.g., Kinesis, Kafka, MQ) to the Lambda .NET Annotations framework, including the attribute class, source generator integration, CloudFormation writer, unit…

    1.7k GitHub stars~3k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • ScottPlot Test Runner

    ScottPlot/ScottPlot

    Run or add ScottPlot 5 tests. Use for unit-test and cookbook-test work; unless explicitly asked otherwise, restrict manual test execution to the Unit Tests…

    6.8k GitHub stars~308 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Aspire Integration Testing

    DevBetterCom/DevBetterWeb

    Write integration tests using .NET Aspire's testing facilities with xUnit.

    157 GitHub starsUsed in 2 repos~2.3k tokens
    Testing & QAAuto-check passed
  • Vstest Build Test

    microsoft/vstest

    Official

    Build, test, and validate changes in the vstest repository. An agent skill from microsoft/vstest.

    969 GitHub stars~1.9k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Coverage Analysis

    runceel/ReactiveProperty

    Automated, project-wide code coverage and CRAP (Change Risk Anti-Patterns) score analysis for .NET projects with existing unit tests.

    944 GitHub stars~5.9k tokensUpdated 1 mo ago
    Testing & QAAuto-check: warnings
  • Unit Testing

    OpenCoreMMO/OpenCoreMMO

    Write, fix, or review NeoServer unit tests using xUnit and FluentAssertions.

    481 GitHub stars~1.6k tokensUpdated 17 days ago
    Testing & QAAuto-check passed

More from microsoft/testfx

All 50 skills in this repo
  • Official

    Guide for organizing MSBuild infrastructure with Directory.Build.props, Directory.Build.targets, Directory.Packages.props, and Directory.Build.rsp.

    1k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Coverage Analysis

    microsoft/testfx

    Official

    Project-wide code coverage and CRAP (Change Risk Anti-Patterns) score analysis for .NET projects.

    1k GitHub stars~7.3k tokensUpdated today
    Auto-check passed
  • Incremental Build

    microsoft/testfx

    Official

    Guide for optimizing MSBuild incremental builds. An agent skill from microsoft/testfx.

    1k GitHub starsUsed in 3 repos~3.7k tokens
    Auto-check passed
  • Official

    Validate TestFx shipping paths and capable CI execution using packed consumers, package/cache provenance, exact exits and artifacts, and selected-versus-executed test evidence.

    1k GitHub stars~4.7k tokensUpdated today
    Auto-check passed
  • Msbuild Modernization

    microsoft/testfx

    Official

    Guide for modernizing and migrating MSBuild project files to SDK-style format.

    1k GitHub starsUsed in 3 repos~4.3k tokens
    Auto-check passed
  • Official

    Guide for interpreting ResolveProjectReferences time in MSBuild performance summaries.

    1k GitHub starsUsed in 3 repos~743 tokens
    Auto-check passed

Works with

Categories

Questions about Migrate Xunit To Xunit V3

What does Migrate Xunit To Xunit V3 do?

Migrates .NET test projects from xUnit.net v2 to xUnit.net v3. Migrate Xunit To Xunit V3 is an agent skill from microsoft/testfx, published by the product's own GitHub organization.net v3.

When should I use Migrate Xunit To Xunit V3?

Migrate Xunit To Xunit V3 fits situations like: : upgrading xunit to xunit.v3; : migrating between test frameworks (MSTest/NUnit to xUnit.net); migrating from VSTest to Microsoft.Testing.Platform (use migrate-vstest-to-mtp).

How do I install Migrate Xunit To Xunit V3 in Claude Code?

Run `npx skills add microsoft/testfx --skill migrate-xunit-to-xunit-v3 -a claude-code`. Or copy the skill folder (.agents/skills/migrate-xunit-to-xunit-v3 in microsoft/testfx) into .claude/skills/migrate-xunit-to-xunit-v3 in your project. Claude Code loads it when a task matches its description.

How do I install Migrate Xunit To Xunit V3 in Codex?

Run `npx skills add microsoft/testfx --skill migrate-xunit-to-xunit-v3 -a codex`. Or copy the skill folder (.agents/skills/migrate-xunit-to-xunit-v3 in microsoft/testfx) into .agents/skills/migrate-xunit-to-xunit-v3 in your project. Codex loads it when a task matches its description.

Can I use Migrate Xunit To Xunit V3 in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/testfx --skill migrate-xunit-to-xunit-v3 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/migrate-xunit-to-xunit-v3, .gemini/skills/migrate-xunit-to-xunit-v3, .github/skills/migrate-xunit-to-xunit-v3 and .opencode/skills/migrate-xunit-to-xunit-v3 in your project.

What does Migrate Xunit To Xunit V3 need to run?

Going by SKILL.md and its folder, Migrate Xunit To Xunit V3 needs the command-line tools its instructions call (dotnet).

Does Migrate Xunit To Xunit V3 access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Migrate Xunit To Xunit V3 safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Migrate Xunit To Xunit V3 use?

Migrate Xunit To Xunit V3 is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Migrate Xunit To Xunit V3 use?

About 2.2k tokens (SKILL.md is roughly 8.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Migrate Xunit To Xunit V3?

Skills that share tags, products or a category with Migrate Xunit To Xunit V3: New Event Source (aws/aws-lambda-dotnet, 1.7k stars), ScottPlot Test Runner (ScottPlot/ScottPlot, 6.8k stars), Aspire Integration Testing (DevBetterCom/DevBetterWeb, 157 stars) and Vstest Build Test (microsoft/vstest, 969 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Migrate Xunit To Xunit V3?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/testfx, which has 1,047 GitHub stars. The repository holds 50 skills in this directory. The repository was last updated on October 9, 2026.

Source: microsoft/testfx on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.