/msbuild:evaluationfrom msbuild
Use when writing or diagnosing an MSBuild declaration, covering the evaluation phase
Ships in msbuild. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Evaluation phase of a Microsoft.NET.Sdk project, from the import chain to the file that owns each declaration.
[REFERENCES]:
Microsoft.NET.Sdk project in order, with the properties each file assignsDirectory.Build.* files with project files holding what differsMSBuild evaluates a project in passes, each pass reads what the earlier passes produced:
| [INDEX] | [PASS] | [READS] |
|---|---|---|
| [01] | Environment variables | Every variable with a valid property name becomes a property |
| [02] | Imports and properties | Properties in order of appearance with imports expanded in place, the last value wins |
| [03] | Item definitions | Properties, and metadata of the same item definition assigned earlier |
| [04] | Items | Final value of every property, and items assigned earlier |
| [05] | UsingTask | Properties |
| [06] | Targets | Nothing runs, the execution phase evaluates each target body in order of appearance |
@(Item) text in a property stays literal until a target expands it@(Item) text operate on the literal textItemGroup, and Target conditions read the final value of every property%(Name) in an item definition reads the definition's own earlier metadata, never the value an item assignsEach repository file reads what the imports before it assigned:
Directory.Build.props reads no project-body value and none from Microsoft.NET.Sdk.props onwardTargetFramework, OutputType, and Configuration are empty in Directory.Build.props unless a global property sets themDirectory.Build.targets reads the project body, the SDK output paths, and every package .targets fileIsPackable, IsTestProject, and EnableDefaultItems hold a value the project or an earlier file assigned-p:TargetFramework= caller supply TargetFramework as a global property, the outer build leaves it empty in every fileobj/*.nuget.g.* imports are absent during restore, no package .props or .targets imports in that passImport rules:
MSB4011 and is ignored010-a before 100-b before 20-c, fixed-width prefixes keep orderMSB4020Microsoft.Common.props imports $(CustomBeforeDirectoryBuildProps) and $(CustomAfterDirectoryBuildProps) around Directory.Build.propsMicrosoft.Common.targets imports $(CustomBeforeDirectoryBuildTargets) and $(CustomAfterDirectoryBuildTargets) around Directory.Build.targetsSdk.props appends UseArtifactsOutputPath.props to $(CustomAfterDirectoryBuildProps)$(ImportDirectoryBuildProps) disables the props file and $(DirectoryBuildPropsPath) names it, from a global property or environment variableDirectory.Build.props can set $(CustomBeforeDirectoryBuildTargets) and $(CustomAfterDirectoryBuildTargets)Files outside the chain:
global.json selects the SDK, rollForward: disable requires an exact match of the listed versiondotnet muxer searches for global.json upward from the current directory, the SDK resolver from the solution or else the project directory.slnx included, evaluate a generated project importing Directory.Solution.props first and Directory.Solution.targets lastDirectory.Build.* file and pass no Directory.Solution.props property to the projects they build$(MSBuildProjectFullPath).user imports when it exists, after the project body and before Directory.Build.targets, in inner and outer buildsDirectory.Build.rsp above the project or solution directory holds default switches, one per line, for every command-line build-noAutoResponse on the command line skips Directory.Build.rsp, inside it fails MSB1027, a dotnet switch inside it fails MSB1001%MSBuildThisFileDirectory% inside Directory.Build.rsp expands to its folderCondition attributes hold one expression string MSBuild tokenizes before it expands properties:
| [INDEX] | [FORM] | [RULE] |
|---|---|---|
| [01] | '$(A)' == 'b', != | Case-insensitive string comparison, quote both sides, an empty side needs its quotes |
| [02] | <, >, <=, >= | Decimal, 0x hexadecimal, or System.Version operands, escaped as < and > |
| [03] | Exists('path') | File or directory test, no wildcard expansion |
| [04] | HasTrailingSlash('path') | True for a trailing / or \ |
| [05] | !, And, Or, ( ) | And binds tighter than Or, a mixed chain without parentheses warns MSB4130 |
| [06] | $([MSBuild]::Fn(...)) | Boolean property functions stand alone, string ones sit inside quotes |
| [07] | $(A.StartsWith('x')) | String instance methods on a property, the value evaluates to True or False |
' fails MSB4092' alone quotes a top-level operand, ' inside a single-quoted attribute evaluatesExists and HasTrailingSlash exist in conditions alone, $([MSBuild]::HasTrailingSlash()) fails MSB4186'1.1' < '1.1.0' is true under System.Version, the [MSBuild]::Version* functions compare by semver rulesPropertyGroup or ItemGroup<!-- Directory.Build.targets -->
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))">
<DefineConstants>$(DefineConstants);FEATURE_SPANS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$([MSBuild]::GetTargetFrameworkIdentifier(`$(TargetFramework)`))' == '.NETCoreApp'">
<DefineConstants>$(DefineConstants);HOST_CORE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<DefineConstants>$(DefineConstants);HOST_MACOS</DefineConstants>
</PropertyGroup>
Properties hold one string, the last assignment in evaluation order wins, a global property wins over every assignment:
$(DefineConstants);FEATURE_A, an assignment without it drops every earlier entryThe "Name" property is a global property, and cannot be modified at diagnostic verbosityTreatAsLocalProperty="Name" on <Project> lets that file and later files override the global value, child projects receive the global valueMSBuildProjectName, MSBuildThisFileDirectory) fail MSB4004 on assignment_ prefixes a property private to its file<PropertyGroup>
<ToolPath>$([MSBuild]::ValueOrDefault('$(ToolPathOverride)', '$(MSBuildThisFileDirectory)tools/tool'))</ToolPath>
<_ToolDir>$([MSBuild]::NormalizeDirectory('$(ToolPath)'))</_ToolDir>
<ToolFile>$([MSBuild]::NormalizePath('$(_ToolDir)', 'tool.exe'))</ToolFile>
<ToolRelative>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)', '$(ToolPath)'))</ToolRelative>
</PropertyGroup>
| [INDEX] | [FUNCTION] | [RESULT] |
|---|---|---|
| [01] | [MSBuild]::NormalizeDirectory(parts...) | Full path with the OS separator and a trailing slash, '' fails |
| [02] | [MSBuild]::NormalizePath(parts...) | Full path with the OS separator, no trailing slash added |
| [03] | [MSBuild]::EnsureTrailingSlash(path) | Value with a trailing slash, '' stays empty |
| [04] | [MSBuild]::MakeRelative(base, path) | path relative to the absolute directory base |
| [05] | [MSBuild]::ValueOrDefault(value, default) | value unless empty, then default |
| [06] | [MSBuild]::GetDirectoryNameOfFileAbove(dir, file) | Nearest directory at or above dir holding file, else empty |
| [07] | [MSBuild]::GetPathOfFileAbove(file, dir) | Full path of the nearest file at or above dir, else empty |
| [08] | [MSBuild]::IsOSPlatform('OSX') | True on the named OSPlatform, Windows, Linux, OSX |
| [09] | [MSBuild]::IsOSUnixLike() | True on Linux or OSX |
| [10] | [MSBuild]::VersionGreaterThanOrEquals(a, b) | Semver-aware compare, v prefix and -/+ suffix ignored, '' fails |
| [11] | [MSBuild]::IsTargetFrameworkCompatible(target, cand) | True when target can consume an asset built for cand |
| [12] | [MSBuild]::GetTargetFrameworkIdentifier(tfm) | .NETCoreApp for net10.0, .NETStandard for netstandard2.0 |
| [13] | [MSBuild]::StableStringHash(text, 'Sha256') | Hash stable across machines and hosts |
| [14] | [System.IO.Path]::GetFileName(path) | Any static method of the allowed System.* classes |
| [15] | [MSBuild]::GetRegistryValue(key, value) | Registry value on Windows under dotnet build, empty on other hosts |
GetDirectoryNameOfFileAbove(dir, file) and fail MSB4184 in GetPathOfFileAbove(file, dir)$(MSBuildThisFileDirectory) names the evaluating file's folder with a trailing slash, $(MSBuildProjectDirectory) the project folder without oneRead a value without a build with dotnet msbuild <project> -getProperty:Name, one name prints the value, a comma list prints JSON, -p: shows the effect of a global property.
Item elements perform one operation each, in order of appearance across every import:
| [INDEX] | [ATTRIBUTE] | [EFFECT] |
|---|---|---|
| [01] | Include | Adds items with the metadata on the element, duplicates stay outside a target |
| [02] | Exclude | Subtracts from the Include of the same element, beside Update it fails MSB4066 |
| [03] | Remove | Removes matching items of that type, Remove="@(Type)" clears it |
| [04] | Update | Sets metadata on items existing at that point, an unmatched spec reports nothing |
| [05] | MatchOnMetadata | Remove="@(Other)" matches on the named metadata, MatchOnMetadataOptions="PathLike" |
| [06] | KeepMetadata, RemoveMetadata | In a target, filters the metadata copied from the source items, definition defaults stay |
| [07] | KeepDuplicates="false" | In a target, skips an item with the identity and metadata of an existing item |
Update applies its metadata to every item of the type, Condition="'%(Identity)' == 'name'" on an item element selects one item@(Item) lists, %(Custom) fails MSB4191 and %(Filename) fails MSB4190@(Item->'%(Meta)') is the one %() form an evaluation-time condition or property accepts, item metadata reads its own item_ (_Parameter1) goes in a child element, as an attribute it fails MSB4066ItemDefinitionGroup sets default metadata for a type, an item's own metadata wins, @(Item) in a definition fails MSB4164Include paths in an imported file resolve against the project directory, a $(MSBuildThisFileDirectory) prefix resolves beside the importing fileFullPath, RootDir, Filename, Extension, RelativeDir, RecursiveDir, Identity, and DefiningProjectDirectory<ItemGroup>
<Source Include="**/*.cs" Exclude="Generated/**;Tests/**" />
<Source Include="Generated/*.cs" Kind="generated" />
<Source Remove="Legacy.cs" />
<Source Update="Generated/*.cs" Owner="tool" />
</ItemGroup>
<!-- Inside a target -->
<ItemGroup>
<Asset Condition="'%(Identity)' == 'config.json'" Copy="PreserveNewest" />
<Copied Include="@(Asset)" KeepMetadata="Copy" />
</ItemGroup>
Item functions and transforms return a new list wherever @() is legal:
| [INDEX] | [EXPRESSION] | [RESULT] |
|---|---|---|
| [01] | @(Item->'%(Filename)%(Extension)') | Transform, one string per item |
| [02] | @(Item->'%(Filename)', ', ') | Transform joined with a separator |
| [03] | @(Item->WithMetadataValue('Kind', 'generated')) | Items with that metadata value, case-insensitive |
| [04] | @(Item->AnyHaveMetadataValue('Kind', 'generated')) | true or false, usable alone as a condition |
| [05] | @(Item->Metadata('Kind')) | Metadata values, source metadata kept |
| [06] | @(Item->Distinct()), ->Count(), ->Reverse() | Identities without duplicates, the count, the reversed list |
| [07] | @(Item->ClearMetadata()) | Identities with every metadata value removed |
| [08] | @(Item->HasMetadata('Kind')), ->Exists() | Items with that metadata name, items present on disk |
Read items with dotnet msbuild <project> -getItem:Type, it prints every item with its well-known metadata as JSON, jq -r '.Items.Type[].Identity' lists the identities.
Each declaration has one owning file, chosen by what it reads and who overrides it:
| [INDEX] | [DECLARATION] | [FILE] |
|---|---|---|
| [01] | Repository root paths, ArtifactsPath, UseArtifactsOutput, ArtifactsProjectName | Directory.Build.props |
| [02] | BaseIntermediateOutputPath, MSBuildProjectExtensionsPath | Directory.Build.props |
| [03] | Defaults a project overrides: Nullable, ImplicitUsings, TreatWarningsAsErrors, AnalysisLevel | Directory.Build.props |
| [04] | Properties every project under one folder shares | Nested Directory.Build.props |
| [05] | Analyzer PackageReference every project gets | Directory.Build.props |
| [06] | GlobalAnalyzerConfigFiles items managed core targets read before Directory.Build.targets | Directory.Build.props |
| [07] | Values derived from TargetFramework, OutputType, or another body property | Directory.Build.targets |
| [08] | Using items, conditioned on @(PackageReference) or not, Update on SDK glob items | Directory.Build.targets |
| [09] | Custom targets and DependsOn extensions | Directory.Build.targets |
| [10] | TargetFramework, OutputType, ArtifactsPivots, PackageReference, ProjectReference | Project file |
| [11] | Package versions, PackageVersion, GlobalPackageReference | Directory.Packages.props |
| [12] | Analyzer severity and options, reaching diagnostics with no source location | .globalconfig |
| [13] | Formatting, code style, path-scoped severity, build_check.* severity and options | .editorconfig |
| [14] | Machine-local overrides | $(MSBuildProjectFullPath).user |
| [15] | Properties and targets a package gives its consumers | Package build/ files |
Directory.Build.props and .targets above a project, a nested file imports the outer one.props files set properties the outer file's conditions read before the import, every other property after it| [INDEX] | [PROBLEM] | [CAUSE] | [FIX] |
|---|---|---|---|
| [01] | Directory.Build.props is not imported | Case differs on a case-sensitive volume | Match the case exactly |
| [02] | Directory.Build.props value is ignored | Project body or the SDK reassigns it later | Set it in Directory.Build.targets |
| [03] | Property holds @(...) text | Properties never read items | Read the list in a target |
| [04] | -getProperty fails with MSB1063 | Argument is a solution | Point the query at one project file |
dotnet msbuild <project> -p:TargetFramework=net10.0 -getProperty:Name evaluates one inner build of a multi-targeting projectWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin msbuild5 skills in this plugin
/packagingUse when changing NuGet configuration, package references, or a .slnx, covering package management and NU codesOther plugins' skills for the same job