including-generated-files

Wire build-generated files into Compile and FileWrites targets in MSBuild projects.

2|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill including-generated-files-sayedihashimi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: including-generated-files
Source: https://github.com/sayedihashimi/copilot-skill-eval/tree/main/examples/aspnet-razor-pages/plugins/dotnet-skills/dotnet-msbuild/skills/including-generated-files
Command: npx skills add https://github.com/sayedihashimi/copilot-skill-eval --skill including-generated-files-sayedihashimi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generated files produced during the MSBuild execution are often not included in the compilation or output, causing missing symbols or artifacts in final builds.

Core Features & Use Cases

  • Hook generated files into Compile and FileWrites with appropriate BeforeTargets timing to ensure they are compiled.
  • Use $(IntermediateOutputPath) as the base location to keep generated artifacts isolated and portable across configurations.
  • Ensure generated files are cleaned by the Clean target to prevent stale artifacts in CI and local environments.

Quick Start

Apply the MSBuild guidance to auto-include any files created by a build step into your Compile items and clean task.

Frequently Asked Questions about including-generated-files

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I include generated files in MSBuild compilation outputs?

To include generated files in MSBuild compilation, wire them into the Compile and FileWrites item groups with appropriate BeforeTargets timing so MSBuild processes them during the build execution.

Why are files generated during the build missing from my dotnet compilation?

Generated files are missing from dotnet compilation when the MSBuild target that creates them does not hook them into the Compile item group with the correct BeforeTargets execution timing.

What is the best way to clean generated files in MSBuild?

The best way to clean generated files in MSBuild is to add them to the FileWrites item group and place them under $(IntermediateOutputPath), ensuring the Clean target removes stale artifacts.

Do I need to place build-generated files in a specific directory for MSBuild?

You need to place build-generated files under $(IntermediateOutputPath) in MSBuild to keep generated artifacts isolated and portable across different build configurations.

When do I need to use BeforeTargets for generated files in MSBuild?

You need to use BeforeTargets in MSBuild when a custom target generates files that must be compiled, ensuring the generation runs before the CoreCompile target processes the Compile items.