What problem does it solve? Files generated during an MSBuild build are invisible to the build process because globs expand during the evaluation phase, before execution creates them. This causes generated source files to be skipped by the compiler (e.g., CS0246 errors for types that should exist), generated content to be missing from output, and stale artifacts to survive the Clean target. ## Core Features & Use Cases - Correct Target Timing: Choose the right BeforeTargets hook (BeforeBuild, CoreCompile;BeforeCompile, or AssignTargetPaths) based on the type of file being generated. - Item Group Registration: Add generated files to Compile, None, or Content item groups inside the generating target, and register them in FileWrites so the Clean target removes them. - Path Best Practices: Use $(IntermediateOutputPath) instead of hardcoded obj/ paths so targets work with redirected intermediate output directories. - Use Case: A custom build task generates a .cs file at build time, but the compiler reports the type does not exist. Hook the target with BeforeTargets="CoreCompile;BeforeCompile" and add the file to the Compile and FileWrites item groups. ## Quick Start Fix my MSBuild target so the .cs file it generates during the build is compiled and cleaned properly.