/msbuild:packagingfrom msbuild
Use when changing NuGet configuration, package references, or a .slnx, covering package management and NU codes
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.
Package and project files of a repository, from project set to CI build properties.
[REFERENCES]:
NU1xxx restore and NU5xxx pack causes and correctionsProject files hold what differs from root Directory.Build.props: Sdk attribute, PackageReference and ProjectReference items, and properties that vary per project. Library/Library.csproj holds:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Item aggregate model</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Contoso.Logging.Abstractions" />
<ProjectReference Include="../Core/Core.csproj" />
</ItemGroup>
</Project>
Files with no place in the project set:
| [INDEX] | [FILE] | [REASON] |
|---|---|---|
| [01] | .nuspec beside an SDK project | NuspecFile discards every project value, pack generates the nuspec |
| [02] | AssemblyInfo.cs | GenerateAssemblyInfo writes the attributes from Version and Description |
| [03] | packages.config | SDK projects restore PackageReference items |
| [04] | app.config in a library | Binding redirects belong to the executable |
| [05] | Directory.Build.rsp with -p: switches | Global properties no project overrides, defaults go in Directory.Build.props |
| [06] | Directory.Solution.props with a project value | Imported by the solution build alone, no project reads the value |
| [07] | Committed .nupkg files | dotnet pack writes them under PackageOutputPath, which .gitignore covers |
| [08] | bin/ or obj/ under the tree | UseArtifactsOutput moves both, a stray copy means a project set its own path |
UseArtifactsOutput or ArtifactsPath in root Directory.Build.props places every output under <ArtifactsPath>/<type>/<project>/<pivot>/:
bin, obj, publish, or package, package/<configuration>/ omits the project nameproject.assets.json, *.nuget.g.props, and *.nuget.g.targets under obj/<project>/UseArtifactsOutput alone sets ArtifactsPath to artifacts beside Directory.Build.propsArtifactsPath takes NormalizePath, SDK composes <ArtifactsPath>\bin\<project>\ itself and a NormalizeDirectory value doubles the separatordotnet msbuild <project> -getProperty:OutputPath shows the composed path<PropertyGroup>
<ArtifactsPath>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', 'out'))</ArtifactsPath>
</PropertyGroup>
Directory.Packages.props owns every version in PackageVersion items, projects name packages without a version. NuGet.props imports the nearest Directory.Packages.props at or above its project directory, a nested file imports its outer one at its top.
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Contoso.Logging.Abstractions" Version="10.0.11" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Contoso.Analyzers" Version="3.0.203" />
</ItemGroup>
</Project>
GlobalPackageReference restores in every project with PrivateAssets=all and no compile asset, its Version sits on the element| [INDEX] | [PROPERTY] | [DEFAULT] | [MEANING] |
|---|---|---|---|
| [01] | CentralPackageVersionOverrideEnabled | true | false rejects VersionOverride, per Directory.Packages.props file |
| [02] | CentralPackageTransitivePinningEnabled | false | Every PackageVersion pins that package when it is transitive |
| [03] | CentralPackageFloatingVersionsEnabled | false | true permits 1.*, restore then depends on the feed state |
| [04] | ManagePackageVersionsCentrally=false | In a nested Directory.Packages.props, removes a tree from CPM |
Transitive pinning restores every transitive package with a PackageVersion item at the item's version, a pin below a dependency's lower bound fails restore with NU1109. dotnet pack promotes pinned transitive packages to explicit nuspec dependencies. PackageVersion Update in a nested file changes one version for one tree.
| [INDEX] | [METADATA] | [EFFECT] |
|---|---|---|
| [01] | VersionOverride | Project restores another version, the PackageVersion item serves every other one |
| [02] | PrivateAssets | Assets consumed here and withheld from consumers, default contentfiles;analyzers;build |
| [03] | IncludeAssets | Assets the project consumes, default all |
| [04] | ExcludeAssets | Assets the project skips, default none |
| [05] | GeneratePathProperty | Defines $(PkgSome_Package) for Some.Package as the package directory |
| [06] | Aliases | C# extern alias for the package assemblies when packages share a namespace |
| [07] | NoWarn | Suppresses a restore code for the one reference |
| [08] | Condition | Adds the reference under a condition, pack maps a TargetFramework condition alone |
ProjectReference with OutputItemType="Analyzer", take PrivateAssets="all"PrivateAssets withholds analyzers assets and passes the package to every referencing project| [INDEX] | [ASSET_CLASS] | [PACKAGE_FOLDER] | [MEANING] |
|---|---|---|---|
| [01] | compile | ref/<tfm>/ or lib/<tfm>/ | Assemblies the compiler references |
| [02] | runtime | lib/ and runtimes/ | Assemblies copied to the output directory |
| [03] | native | runtimes/<rid>/native/ | Native libraries copied to the output directory |
| [04] | contentFiles | contentFiles/ | Files added to the consuming project as items |
| [05] | build | build/ | .props and .targets imported by the direct consumer |
| [06] | buildTransitive | buildTransitive/ | .props and .targets imported by every consumer down the graph |
| [07] | buildMultitargeting | buildMultitargeting/ | .props and .targets imported by the outer multi-targeting build |
| [08] | analyzers | analyzers/ | Roslyn analyzers and source generators |
Directory.Build.targets evaluates after the project's own properties and PackageReference items, a reference depending on a project property belongs there:
<ItemGroup>
<PackageReference Include="Contoso.Hosting" Condition="'$(OutputType)' == 'Exe'" />
</ItemGroup>
| [INDEX] | [COMMAND] | [EFFECT] |
|---|---|---|
| [01] | dotnet package add <id> --project <csproj> | Adds the reference, under CPM the version goes to PackageVersion |
| [02] | dotnet package add <id>@<version> --project <csproj> | Same with a pinned version, --prerelease accepts a prerelease |
| [03] | dotnet package list --project <csproj> --include-transitive | Resolved versions, --outdated compares feeds, --format json |
| [04] | dotnet package remove <id> --project <csproj> | Removes the reference, the PackageVersion item stays |
| [05] | dotnet package search <term> --source <url> | Feed search, --exact-match lists every version of one id |
| [06] | dotnet add package | Verb-first spelling of dotnet package add |
SemVer precedence misorders the prerelease builds a CI labels by branch or by build number:
<n>-<branch>-<build> outranks <n>-dev-<build> when <branch> sorts after dev<n>-alpha9 outranks <n>-alpha13version, floating *-*, and dotnet package list --outdated return the SemVer maximumpublished and listed, an unlisted leaf reads published as 1900-01-01PackageReference compatibility follows ManagedCodeConventions asset selection for the target frameworkVersionRange.TryParse with allowFloating reads an exact range ([x.y.z]) and a floating version (1.*)Restore resolves requested ranges through NuGet's lowest applicable version and direct-dependency rules. Central transitive pinning adds catalog entries to that resolution.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="contoso" value="https://pkgs.contoso.example/nuget/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
<packageSource key="contoso">
<package pattern="Contoso.*" />
</packageSource>
</packageSourceMapping>
</configuration>
<clear /> removes every source a user or machine NuGet.config adds<disabledPackageSources><clear /></disabledPackageSources> removes inherited disablespackageSourceMapping routes every id, transitive ones included, to the source with a matching pattern* is the defaultNU1507 with more than one HTTP source and no mappingglobalPackagesFolder in a repository <config> splits its packages from outside restoresglobalPackagesFolder and repositoryPath values resolve against the directory of the NuGet.config that sets themglobalPackagesFolder applies to PackageReference, repositoryPath applies to packages.configNUGET_PACKAGES overrides globalPackagesFolder alone, a relative value fails restoreRestoreSources replaces the configured sources for one restore, RestoreAdditionalProjectSources adds to themRestoreIgnoreFailedSources turns an unreachable source into a warningmaxHttpRequestsPerSource in <config> bounds concurrent requests to each source, NuGet on .NET sets no bound without itRestoreUseStaticGraphEvaluation in Directory.Build.props applies to a project restoreRestoreUseStaticGraphEvaluation from -p: or from Directory.Solution.propsNuGetAudit=false skips the vulnerability fetchRestoreEnablePackagePruning is on for every framework of a project targeting net10.0 or laterPrivateAssets=all and IncludeAssets=none, NU1510 asks for removal when every framework prunes the reference| [INDEX] | [COMMAND] | [EFFECT] |
|---|---|---|
| [01] | dotnet restore --force | Resolves again as if project.assets.json were deleted, keeps the HTTP cache |
| [02] | dotnet restore --runtime <rid> | Global RuntimeIdentifiers=<rid>, -p:RuntimeIdentifier=<rid> sets the singular property |
| [03] | dotnet restore -p:Name=Value | Global property for the restore evaluation |
| [04] | dotnet nuget locals all --list | Paths of global-packages, http-cache, temp, and plugins-cache |
| [05] | dotnet nuget locals http-cache --clear | Deletes the 30 minute feed cache after a package republish |
dotnet pack reads every value from the project. IsPackable=false in root Directory.Build.props makes dotnet pack skip every project that keeps it, with no build and no message. Package projects set IsPackable=true with Version, Description, and PackageLicenseExpression. Contoso.Native.Item/Contoso.Native.Item.csproj holds:
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<IsPackable>true</IsPackable>
<Version>1.0.0</Version>
<Description>Item shared library per runtime identifier</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<TargetFramework>netstandard2.0</TargetFramework>
<EnableDefaultItems>false</EnableDefaultItems>
</PropertyGroup>
<ItemGroup>
<None Include="runtimes/**" Pack="true" PackagePath="runtimes/" />
<None Include="buildTransitive/**" Pack="true" PackagePath="buildTransitive/" />
<None Include="_._" Pack="true" PackagePath="lib/$(TargetFramework)/" />
</ItemGroup>
</Project>
EnableDefaultItems=false removes the default None glob, each packed file is one itemlib/<tfm>/_._ is an empty file on disk that marks a framework the package supports, pack targets emit a matching dependency groupruntimes/<rid>/native/, the SDK copies each matching RID directory and flattens it on publishruntimes/<rid>/lib/<tfm>/ with an AnyCPU compile assembly under ref/<tfm>/ref/ over lib/ and runtime assets from runtimes/ over lib/contentFiles/any/any/ with PackageCopyToOutput="true" writes copyToOutput="true" to the nuspec, for a data file a runtime opens by pathbuild/ and buildTransitive/ files for one framework import buildTransitive/ alone.props files set properties under a condition the consumer can overridePackagePath with the file's extension names the file, any other value names a folder that keeps each glob item's %(RecursiveDir)Pack="true" on None includes the item, Pack="false" on Content excludes itDeterministic gives every zip entry the DeterministicTimestamp time, RFC 3339 or Unix secondsSOURCE_DATE_EPOCH fills DeterministicTimestamp when unset, the wall clock otherwise| [INDEX] | [PROPERTY] | [EFFECT] |
|---|---|---|
| [01] | PackageId, Version | Id defaults to AssemblyName, prefix and suffix properties compose Version |
| [02] | PackageOutputPath | Directory of the .nupkg files |
| [03] | IncludeBuildOutput=false | No assembly in lib/, the NoTargets default |
| [04] | PackageReadmeFile, PackageIcon | Package paths of a Markdown readme and a PNG or JPEG icon packed with Pack="true" |
| [05] | PackageLicenseExpression | SPDX expression, PackageLicenseFile is the alternative for a packed file |
| [06] | IncludeSymbols, SymbolPackageFormat | snupkg writes the portable PDBs beside the .nupkg |
| [07] | PublishRepositoryUrl | Source Link repository URL and branch in the nuspec, the commit goes in without it |
| [08] | PackAsTool, ToolCommandName | Packs an executable as a dotnet tool, the SDK imports the tool pack targets |
| [09] | DevelopmentDependency | Build-time dependency, consumers exclude its compile assets |
| [10] | PackageType | Semicolon list of package types, Dependency is the default |
| [11] | NoPackageAnalysis | Skips the NU5xxx analysis, for a layout the rules cannot describe |
| [12] | NuspecFile | Packs a hand-written nuspec and ignores the project, for a non-SDK package |
GenerateNuspec runs after Build and after _GetPackageFiles collects the Pack="true" items. Validation targets take BeforeTargets="GenerateNuspec". Targets that add files take a TargetsForTfmSpecificContentInPackage entry and return TfmSpecificPackageFile items with PackagePath metadata, or a TargetsForTfmSpecificBuildOutput entry for files in lib/.
| [INDEX] | [COMMAND] | [EFFECT] |
|---|---|---|
| [01] | dotnet pack | Release is the default configuration of pack |
| [02] | dotnet pack --no-build | Packs the existing build output, implies --no-restore |
| [03] | dotnet pack -o <dir> | Overrides PackageOutputPath for one run |
| [04] | dotnet pack -p:PackageVersion=1.2.0 | Version for one run, --version-suffix sets VersionSuffix alone |
| [05] | dotnet pack -p:DeterministicTimestamp=<seconds> | Timestamp for one run, the first build's value reproduces the package |
| [06] | dotnet pack -getItem:NuGetPackOutput | Prints the package paths as JSON |
.slnx is dotnet new sln's default. Solution folders match repository layout, a project a task runner builds on its own stays out of the solution.
<Solution>
<Folder Name="/apps/">
<Project Path="apps/Tool/Tool.csproj" />
</Folder>
<Folder Name="/libs/">
<Project Path="libs/Library/Library.csproj" />
</Folder>
</Solution>
| [INDEX] | [COMMAND] | [EFFECT] |
|---|---|---|
| [01] | dotnet new sln -n Product | Empty .slnx, --format sln writes the old format |
| [02] | dotnet sln Product.slnx add <csproj> --solution-folder libs | Adds project and references to a folder, --in-root to root |
| [03] | dotnet sln Product.slnx remove <csproj> | Removes the entry, <csproj> can be the project folder |
| [04] | dotnet sln Product.slnx list | Project paths |
| [05] | dotnet sln Product.sln migrate | Writes Product.slnx beside the .sln |
| [INDEX] | [ELEMENT] | [PURPOSE] |
|---|---|---|
| [01] | Solution | Root, optional Description and Version attributes |
| [02] | Folder | Solution folder by Name, holds Project and File children |
| [03] | Project | Path relative to the solution, optional Type and DisplayName, BuildDependency rows |
| [04] | Configurations | Holds BuildType and Platform rows, absent when Debug, Release, and Any CPU apply |
| [05] | Build, Deploy | Per-project Solution and Project configuration mapping under Project |
| [06] | Properties | Named Property rows, Scope is PostLoad |
Directory.Solution.props and Directory.Solution.targetsDirectory.Build.props.slnx builds import before.<name>.sln.targets and after.<name>.sln.targets beside the solution, their name keeps .sln for both formats.slnf filters name a .slnx in path, dotnet build Filter.slnf builds the listed projects and their referencesdotnet build Library/Library.csproj builds one project and its referencesProject rows fail every solution command with an error naming the duplicate pathEvery CI property sits in one PropertyGroup in root Directory.Build.props under a condition on a property the pipeline passes with -p:CI=true or exports as environment variable CI, switches sit on pipeline command lines.
<PropertyGroup Label="Continuous integration" Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
ContinuousIntegrationBuild enables DeterministicSourcePathsTreatWarningsAsErrors covers compiler and NuGet warnings, MSBuildTreatWarningsAsErrors covers warnings MSBuild tasks and BuildCheck logSatelliteResourceLanguages=en keeps named satellite assemblies, GenerateDocumentationFile=true writes the XML file and enables CS1591-windows framework set EnableWindowsTargeting, any other project leaves it unset and fails NETSDK1100 on oneglobal.json without sdk.version selects the newest installed SDK, DOTNET_ROLL_FORWARD governs which runtime an application host selectsmsbuild:diagnostics for BuildCheck on the pipeline builddotnet restore Product.slnx -p:CI=true
dotnet build Product.slnx --no-restore -p:CI=true -warnaserror -nodeReuse:false
dotnet test --solution Product.slnx --no-build --report-trx
| [INDEX] | [SWITCH] | [EFFECT] |
|---|---|---|
| [01] | --no-restore, --no-build | test --no-build implies --no-restore, restore once and build once per pipeline |
| [02] | -clp:Summary;ErrorsOnly | Console logger parameters, -v:m sets the verbosity |
| [03] | -m, -maxCpuCount | One node per processor, dotnet build passes it |
| [04] | -nodeReuse:false | Worker nodes exit with the build and no MSBuild server starts, both otherwise outlive it |
| [05] | -p:UseSharedCompilation=false | csc runs as a child process, the Roslyn server otherwise idles 10 minutes past a build |
| [INDEX] | [VARIABLE] | [EFFECT] |
|---|---|---|
| [01] | DOTNET_NOLOGO=1 | No first-run banner |
| [02] | DOTNET_CLI_TELEMETRY_OPTOUT=1 | No telemetry |
| [03] | DOTNET_GENERATE_ASPNET_CERTIFICATE=0 | No development certificate on first run |
| [04] | DOTNET_ADD_GLOBAL_TOOLS_TO_PATH=0 | No PATH edit on first run |
| [05] | DOTNET_CLI_HOME=<dir> | Moves first-run sentinels, workloads, local tools, and packages folder |
| [06] | MSBUILDDISABLENODEREUSE=1 | -nodeReuse:false for every MSBuild process, one a tool starts included |
| [INDEX] | [SMELL] | [CORRECT_FORM] |
|---|---|---|
| [01] | Reference with a HintPath into ~/.nuget | PackageReference with GeneratePathProperty when a path is needed |
| [02] | PackageVersion with 1.* | Exact version, the upgrade moves it |
| [03] | VersionOverride in more than one project | One PackageVersion item, or a nested file with PackageVersion Update |
| [04] | PackageReference with Version under CPM | PackageVersion in Directory.Packages.props |
| [05] | NuGet.config without <clear /> | <clear /> first, then the named sources and their mappings |
| [06] | Central versions treated as a resolved dependency graph | Central versions own declarations, lock files hold each resolved closure |
| [07] | GeneratePackageOnBuild in a library | dotnet pack from the pipeline, a build then writes no package |
| [08] | Packed build/ props setting a property unconditionally | Condition="'$(Name)' == ''", the consumer keeps its own value |
| [09] | Native libraries under contentFiles | runtimes/<rid>/native/, the one layout with RID selection |
| [10] | SuppressDependenciesWhenPacking with a lib/<tfm>/ entry | Dependency group stays |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin msbuild5 skills in this plugin
Other plugins' skills for the same job
/executionUse when writing or ordering an MSBuild target, covering the execution phase