dotnet-msbuild-authoring

Author MSBuild targets, properties, and incremental build logic for .NET projects.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-msbuild-authoring-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-msbuild-authoring
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-msbuild-authoring
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-msbuild-authoring-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill empowers developers to deeply customize their .NET build process by authoring MSBuild targets, properties, and item definitions, enabling fine-grained control over project compilation and packaging.

Core Features & Use Cases

  • Custom Targets: Define and inject custom build steps using BeforeTargets, AfterTargets, and DependsOnTargets.
  • Incremental Builds: Optimize build times by implementing Inputs and Outputs for targets.
  • Project Structure: Understand and leverage Directory.Build.props and Directory.Build.targets for scalable project configurations.
  • Use Case: You need to automatically generate version information into a C# file before compilation or ensure a specific code analysis tool runs before the build completes.

Quick Start

Create a custom MSBuild target named 'PrintBuildInfo' that runs before the 'Build' target and prints the project name and target framework.

Frequently Asked Questions about dotnet-msbuild-authoring

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

FAQPage Schema
How do I create custom MSBuild targets that run before or after the build?

Custom MSBuild targets execute at specific build stages by using the `BeforeTargets`, `AfterTargets`, and `DependsOnTargets` attributes to inject custom build steps for SDK-style projects.

How do I configure Directory.Build.props for multiple .NET projects?

Directory.Build.props centralizes MSBuild properties across multiple .NET projects by defining shared configurations at the directory level, enabling scalable project structure management.

How do incremental MSBuild builds work with Inputs and Outputs?

Incremental MSBuild builds optimize build times by evaluating target `Inputs` and `Outputs` metadata, skipping target execution when output files are already up-to-date relative to inputs.

Can I use property functions and conditions in SDK-style projects targeting .NET 8?

Yes, SDK-style projects targeting .NET 8.0+ fully support MSBuild property functions and conditions, allowing dynamic property evaluation and conditional build logic during compilation.

How do I generate a C# file automatically before MSBuild compilation?

Automatically generating a C# file before compilation requires authoring a custom MSBuild target that hooks into the build pipeline using `BeforeTargets` to write version information or generated code.