Official agent skill

Including Generated Files

by microsoft in microsoft/testfx

Fix MSBuild targets that generate files during the build but those files are missing from compilation or output.

OfficialMITAuto-check passed

Install Including Generated Files

skills CLI
$ npx skills add microsoft/testfx --skill including-generated-files -a claude-code

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

GitHub CLI
$ gh skill install microsoft/testfx including-generated-files --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/including-generated-files .claude/skills/including-generated-files && 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
including-generated-files
GitHub stars
1k
Used in
2 other repos
Token cost
~1.8k tokens
SKILL.md length
581 words
Files
1
Skills in repo
44
Repo updated
First seen
Licence
MIT

At a glance

Fix MSBuild targets that generate files during the build but those files are missing from compilation or output.

  • : generated source files not compiling (CS0246 for a type that should exist)
  • SKILL.md covers Overview, Quick Takeaway, Why Generated Files Are Ignored and Solution: Manually Add…, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Custom build tasks that create files but they are invisible to subsequent targets

What it does

Including Generated Files is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Fix MSBuild targets that generate files during the build but those files are missing from compilation or output. USE FOR: generated source files not compiling (CS0246 for a type that should exist), custom build tasks that create files but they are invisible to subsequent targets, globs not capturing build-generated files because they expand at evaluation time before execution creates them, ensuring generated files are cleaned by the Clean target. Covers correct BeforeTargets timing (CoreCompile, BeforeBuild…

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

It works with C#. 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

  • : generated source files not compiling (CS0246 for a type that should exist)
  • Custom build tasks that create files but they are invisible to subsequent targets
  • Globs not capturing build-generated files because they expand at evaluation time before execution creates them
  • Ensuring generated files are cleaned by the Clean target

Example prompts

  • “/including-generated-files”

What it can do on your machine

Read from SKILL.md and the folder at commit 44b9dcc. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are xml).

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

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.microsoft.com
    • github.com
    • learn.microsoft.com

    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

Including Generated Files loads about 1.8k tokens when it runs. Until then it costs about 207 tokens; SKILL.md has 581 words of instructions outside code blocks.

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

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 44b9dcc, republished under its MIT licence (© microsoft). 581 words, ~1,815 tokens.

Download SKILL.mdSave it as .claude/skills/including-generated-files/SKILL.md (or your agent's skills folder).
name
including-generated-files
description
Fix MSBuild targets that generate files during the build but those files are missing from compilation or output. USE FOR: generated source files not compiling (CS0246 for a type that should exist), custom build tasks that create files but they are invisible to subsequent targets, globs not capturing build-generated files because they expand at evaluation time before execution creates them, ensuring generated files are cleaned by the Clean target. Covers correct BeforeTargets timing (CoreCompile, BeforeBuild, AssignTargetPaths), adding to Compile/FileWrites item groups, using $(IntermediateOutputPath) instead of hardcoded obj/ paths. DO NOT USE FOR: C# source generators that already work via the Roslyn pipeline, T4 design-time generation that runs in Visual Studio, non-MSBuild build systems.
license
MIT

Including Generated Files Into Your Build

Overview

Files generated during the build are generally ignored by the build process. This leads to confusing results such as:

  • Generated files not being included in the output directory
  • Generated source files not being compiled
  • Globs not capturing files created during the build

This happens because of how MSBuild's build phases work.

Quick Takeaway

For code files generated during the build - we need to add those to Compile and FileWrites item groups within the target generating the file(s):

xml
  <ItemGroup>
    <Compile Include="$(GeneratedFilePath)" />
    <FileWrites Include="$(GeneratedFilePath)" />
  </ItemGroup>

The target generating the file(s) should be hooked before CoreCompile and BeforeCompile targets - BeforeTargets="CoreCompile;BeforeCompile"

Why Generated Files Are Ignored

For detailed explanation, see How MSBuild Builds Projects.

Evaluation Phase

MSBuild reads your project, imports everything, creates Properties, expands globs for Items outside of Targets, and sets up the build process.

Execution Phase

MSBuild runs Targets & Tasks with the provided Properties & Items to perform the build.

Key Takeaway: Files generated during execution don't exist during evaluation, therefore they aren't found. This particularly affects files that are globbed by default, such as source files (.cs).

Solution: Manually Add Generated Files

When files are generated during the build, manually add them into the build process. The approach depends on the type of file being generated.

Use $(IntermediateOutputPath) for Generated File Location

Always use $(IntermediateOutputPath) as the base directory for generated files. Do not hardcode obj\ or construct the intermediary path manually (e.g., obj\$(Configuration)\$(TargetFramework)\). The intermediate output path can be redirected to a different location in some build configurations (e.g., shared output directories, CI environments). Using $(IntermediateOutputPath) ensures your target works correctly regardless of the actual path.

Always Add Generated Files to FileWrites

Every generated file should be added to the FileWrites item group. This ensures that MSBuild's Clean target properly removes your generated files. Without this, generated files will accumulate as stale artifacts across builds.

xml
<ItemGroup>
  <FileWrites Include="$(IntermediateOutputPath)my-generated-file.xyz" />
</ItemGroup>
Basic Pattern (Non-Code Files)

For generated files that need to be copied to output (config files, data files, etc.), add them to Content or None items before BeforeBuild:

xml
<Target Name="IncludeGeneratedFiles" BeforeTargets="BeforeBuild">
  
  <!-- Your logic that generates files goes here -->

  <ItemGroup>
    <None Include="$(IntermediateOutputPath)my-generated-file.xyz" CopyToOutputDirectory="PreserveNewest"/>
    
    <!-- Capture all files of a certain type with a glob -->
    <None Include="$(IntermediateOutputPath)generated\*.xyz" CopyToOutputDirectory="PreserveNewest"/>

    <!-- Register generated files for proper cleanup -->
    <FileWrites Include="$(IntermediateOutputPath)my-generated-file.xyz" />
    <FileWrites Include="$(IntermediateOutputPath)generated\*.xyz" />
  </ItemGroup>
</Target>
Show full SKILL.md (247 more words)Show less
For Generated Source Files (Code That Needs Compilation)

If you're generating .cs files that need to be compiled, use BeforeTargets="CoreCompile;BeforeCompile". This is the correct timing for adding Compile items — it runs late enough that the file generation has occurred, but before the compiler runs. Using BeforeBuild is too early for some scenarios and may not work reliably with all SDK features.

xml
<Target Name="IncludeGeneratedSourceFiles" BeforeTargets="CoreCompile;BeforeCompile">
  <PropertyGroup>
    <GeneratedCodeDir>$(IntermediateOutputPath)Generated\</GeneratedCodeDir>
    <GeneratedFilePath>$(GeneratedCodeDir)MyGeneratedFile.cs</GeneratedFilePath>
  </PropertyGroup>

  <MakeDir Directories="$(GeneratedCodeDir)" />

  <!-- Your logic that generates the .cs file goes here -->

  <ItemGroup>
    <Compile Include="$(GeneratedFilePath)" />
    <FileWrites Include="$(GeneratedFilePath)" />
  </ItemGroup>
</Target>

Note: Specifying both CoreCompile and BeforeCompile ensures the target runs before whichever target comes first, providing robust ordering regardless of customizations in the build.

Target Timing

Choose the BeforeTargets value based on the type of file being generated:

  • BeforeTargets="BeforeBuild" — For non-code files added to None or Content. Runs early enough for copy-to-output scenarios.
  • BeforeTargets="CoreCompile;BeforeCompile" — For generated source files added to Compile. Ensures the file is included before the compiler runs.
  • BeforeTargets="AssignTargetPaths" — The "final stop" before None and Content items (among others) are transformed into new items. Use as a fallback if BeforeBuild is too early.

Globbing Behavior

Globs behave according to when the glob took place:

Glob LocationFiles Captured
Outside of a targetOnly files visible during Evaluation phase (before build starts)
Inside of a targetFiles visible when the target runs (can capture generated files if timed correctly)

This is why the solution places the <ItemGroup> inside a <Target> - the glob runs during execution when the generated files exist.

© 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/including-generated-files of microsoft/testfx.

Open the folder on GitHubat commit 44b9dcc

Used in 2 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in microsoft/testfx, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Including Generated Files 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.

Including Generated Files compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Including Generated Files this skillmicrosoft/testfx1k2 repos~1.8kAutomated safety check: PassMIT
Minimax DOCXpoco-ai/poco-claw1.4k7 repos~3.9kAutomated safety check: PassMIT
Speckit ConstitutionWeihanLi/WeihanLi.Common24211 repos~2.1kAutomated safety check: PassApache-2.0
Code Audit3stoneBrother/code-audit8931 repos~2.7kAutomated safety check: PassNone
Build Teaql Appteaql/teaql-agent-kit2.8k—~4.6kAutomated safety check: PassMIT
Issue Fixmono/SkiaSharp5.6k—~5.1kAutomated safety check: PassMIT

Similar skills

  • Minimax DOCX

    poco-ai/poco-claw

    Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET).

    1.4k GitHub starsUsed in 7 repos~3.9k tokens
    Documents & OfficeAuto-check passed
  • Speckit Constitution

    WeihanLi/WeihanLi.Common

    Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.

    242 GitHub starsUsed in 11 repos~2.1k tokens
    DevelopmentAuto-check passed
  • Code Audit

    3stoneBrother/code-audit

    Professional code security audit skill covering 55+ vulnerability types.

    893 GitHub starsUsed in 1 repo~2.7k tokens
    SecurityAuto-check passed
  • Build Teaql App

    teaql/teaql-agent-kit

    Build or change a TeaQL application in Java, Rust, Go, Swift, Python, C/.NET, or TypeScript, including Kotlin/JVM applications that consume Java-generated libraries.

    2.8k GitHub stars~4.6k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Issue Fix

    mono/SkiaSharp

    Fix bugs in SkiaSharp C bindings. An agent skill from mono/SkiaSharp.

    5.6k GitHub stars~5.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Uloop Execute Dynamic Code

    CyberAgentGameEntertainment/NovaShader

    Execute C with Unity APIs when existing uloop tools cannot inspect or edit enough.

    1.6k GitHub starsUsed in 1 repo~1.9k tokens
    Game DevelopmentAuto-check passed

More from microsoft/testfx

All 44 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
  • Binlog Failure Analysis

    microsoft/testfx

    Official

    Analyze MSBuild binary logs to diagnose build failures. An agent skill from microsoft/testfx.

    1k GitHub starsUsed in 3 repos~730 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
  • 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
  • Msbuild Antipatterns

    microsoft/testfx

    Official

    Catalog of MSBuild anti-patterns with detection rules and fix recipes.

    1k GitHub stars~4.5k tokensUpdated today
    Auto-check passed

Works with

Questions about Including Generated Files

What does Including Generated Files do?

Fix MSBuild targets that generate files during the build but those files are missing from compilation or output. Including Generated Files is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Fix MSBuild targets that generate files during the build but those files are missing from compilation or output.

When should I use Including Generated Files?

Including Generated Files fits situations like: : generated source files not compiling (CS0246 for a type that should exist); custom build tasks that create files but they are invisible to subsequent targets; globs not capturing build-generated files because they expand at evaluation time before execution creates them; ensuring generated files are cleaned by the Clean target.

How do I install Including Generated Files in Claude Code?

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

How do I install Including Generated Files in Codex?

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

Can I use Including Generated Files 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 including-generated-files -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/including-generated-files, .gemini/skills/including-generated-files, .github/skills/including-generated-files and .opencode/skills/including-generated-files in your project.

What does Including Generated Files need to run?

SKILL.md names no scripts, command-line tools or credentials: Including Generated Files is instructions for the agent only.

Does Including Generated Files access the network?

SKILL.md names 3 domains. As links in the text: docs.microsoft.com, github.com and learn.microsoft.com. This is read from the text; nothing was executed.

Is Including Generated Files 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 Including Generated Files use?

Including Generated Files 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 Including Generated Files use?

About 1.8k tokens (SKILL.md is roughly 7.3k 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 Including Generated Files?

Skills that share tags, products or a category with Including Generated Files: Minimax DOCX (poco-ai/poco-claw, 1.4k stars), Speckit Constitution (WeihanLi/WeihanLi.Common, 242 stars), Code Audit (3stoneBrother/code-audit, 893 stars) and Build Teaql App (teaql/teaql-agent-kit, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Including Generated Files?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/testfx, which has 1,047 GitHub stars. The repository holds 44 skills in this directory. The repository was last updated on October 7, 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.