[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DZ6DCCK38RK5ZBBA98S7K1":3,"skill-same:01M6DZ6DCCK38RK5ZBBA98S7K1":90},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6DZ6DCCK38RK5ZBBA98S7K1","msbuild-antipatterns",null,"DO NOT INVOKE when the primary request explicitly asks to convert, migrate, modernize, or rewrite a legacy\u002Fold-style project to SDK style; use msbuild-modernization. Migration prompts often mention ToolsVersion, explicit Compile\u002FReference entries, packages.config, or Microsoft.CSharp.targets, but merely reviewing or auditing a file that contains those patterns remains in scope here. USE FOR broad review, audit, lint, or maintainability\u002Fcorrectness checks of project\u002Fbuild files, including custom targets; prioritized cross-cutting findings; discrete anti-patterns; F# ordering\u002FFS0039; cross-platform paths; and focused Import safety verdicts. Review\u002Faudit is analysis-only unless fixes are requested. For concrete property\u002Fitem defects use property-patterns\u002Fitem-management; use target-authoring for implementation and extension-points for NuGet auto-import\u002Flayout discovery. Exclude non-MSBuild systems.","managedcode\u002Fdotnet-skills","managedcode","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F78253589?v=4","01M6DYDJR3EG8KB5G4PC65XCTT","Managed Code","01M6DYDJX0ZT432N04NYJW89DN",515,"MIT","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"msbuild antipatterns","msbuild","antipatterns","when","review","invoke","request","paths","scope","authoring","layout","project","patterns","files","only","auto","anti-patterns","migrate","analysis","Safety","audit","packages","modernization","config","2026-11-10 10:12:30",false,"---\nname: msbuild-antipatterns\ndescription: \"DO NOT INVOKE when the primary request explicitly asks to convert, migrate, modernize, or rewrite a legacy\u002Fold-style project to SDK style; use msbuild-modernization. Migration prompts often mention ToolsVersion, explicit Compile\u002FReference entries, packages.config, or Microsoft.CSharp.targets, but merely reviewing or auditing a file that contains those patterns remains in scope here. USE FOR broad review, audit, lint, or maintainability\u002Fcorrectness checks of project\u002Fbuild files, including custom targets; prioritized cross-cutting findings; discrete anti-patterns; F# ordering\u002FFS0039; cross-platform paths; and focused Import safety verdicts. Review\u002Faudit is analysis-only unless fixes are requested. For concrete property\u002Fitem defects use property-patterns\u002Fitem-management; use target-authoring for implementation and extension-points for NuGet auto-import\u002Flayout discovery. Exclude non-MSBuild systems.\"\nlicense: MIT\n---\n\n# MSBuild Anti-Pattern Catalog\n\nA numbered catalog of common MSBuild anti-patterns. Each entry follows the format:\n\n- **Smell**: What to look for\n- **Why it's bad**: Impact on builds, maintainability, or correctness\n- **Fix**: Concrete transformation\n\nUse this catalog when scanning project files for improvements.\n\n## Review output contract\n\nFor review, audit, maintainability, or correctness-risk requests:\n\n1. Do not edit files unless the user explicitly asks for fixes.\n2. Return prioritized findings grounded in the supplied file, with impact and a targeted recommendation.\n3. Separate confirmed defects from conditional risks and already-correct patterns.\n4. Keep the final answer as the review; do not replace it with a terse summary of changes.\n\n---\n\n## AP-01: `\u003CExec>` for Operations That Have Built-in Tasks\n\n**Smell**: `\u003CExec Command=\"mkdir ...\" \u002F>`, `\u003CExec Command=\"copy ...\" \u002F>`, `\u003CExec Command=\"del ...\" \u002F>`\n\n**Why it's bad**: Built-in tasks are cross-platform, support incremental build, emit structured logging, and handle errors consistently. `\u003CExec>` is opaque to MSBuild.\n\n```xml\n\u003C!-- BAD -->\n\u003CTarget Name=\"PrepareOutput\">\n  \u003CExec Command=\"mkdir $(OutputPath)logs\" \u002F>\n  \u003CExec Command=\"copy config.json $(OutputPath)\" \u002F>\n  \u003CExec Command=\"del $(IntermediateOutputPath)*.tmp\" \u002F>\n\u003C\u002FTarget>\n\n\u003C!-- GOOD -->\n\u003CTarget Name=\"PrepareOutput\">\n  \u003CMakeDir Directories=\"$(OutputPath)logs\" \u002F>\n  \u003CCopy SourceFiles=\"config.json\" DestinationFolder=\"$(OutputPath)\" \u002F>\n  \u003CDelete Files=\"@(TempFiles)\" \u002F>\n\u003C\u002FTarget>\n```\n\n**Built-in task alternatives:**\n\n| Shell Command | MSBuild Task |\n|--------------|--------------|\n| `mkdir` | `\u003CMakeDir>` |\n| `copy` \u002F `cp` | `\u003CCopy>` |\n| `del` \u002F `rm` | `\u003CDelete>` |\n| `move` \u002F `mv` | `\u003CMove>` |\n| `echo text > file` | `\u003CWriteLinesToFile>` |\n| `touch` | `\u003CTouch>` |\n| `xcopy \u002Fs` | `\u003CCopy>` with item globs |\n\n---\n\n## AP-02: Unquoted Condition Expressions\n\n**Smell**: `Condition=\"$(Foo) == Bar\"` — either side of a comparison is unquoted.\n\n**Why it's bad**: If the property is empty or contains spaces\u002Fspecial characters, the condition evaluates incorrectly or throws a parse error. MSBuild requires single-quoted strings for reliable comparisons.\n\n```xml\n\u003C!-- BAD -->\n\u003CPropertyGroup Condition=\"$(Configuration) == Release\">\n  \u003COptimize>true\u003C\u002FOptimize>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD -->\n\u003CPropertyGroup Condition=\"'$(Configuration)' == 'Release'\">\n  \u003COptimize>true\u003C\u002FOptimize>\n\u003C\u002FPropertyGroup>\n```\n\n**Rule**: Always quote **both** sides of `==` and `!=` comparisons with single quotes.\n\n---\n\n## AP-03: Hardcoded Absolute Paths\n\n**Smell**: Paths like `C:\\tools\\`, `D:\\packages\\`, `\u002Fusr\u002Flocal\u002Fbin\u002F` in project files.\n\n**Why it's bad**: Breaks on other machines, CI environments, and other operating systems. Not relocatable.\n\n```xml\n\u003C!-- BAD -->\n\u003CPropertyGroup>\n  \u003CToolPath>C:\\tools\\mytool\\mytool.exe\u003C\u002FToolPath>\n\u003C\u002FPropertyGroup>\n\u003CImport Project=\"C:\\repos\\shared\\common.props\" \u002F>\n\n\u003C!-- GOOD -->\n\u003CPropertyGroup>\n  \u003CToolPath>$(MSBuildThisFileDirectory)tools\\mytool\\mytool.exe\u003C\u002FToolPath>\n\u003C\u002FPropertyGroup>\n\u003CImport Project=\"$(RepoRoot)eng\\common.props\" \u002F>\n```\n\n**Preferred path properties:**\n\n| Property | Meaning |\n|----------|---------|\n| `$(MSBuildThisFileDirectory)` | Directory of the current .props\u002F.targets file |\n| `$(MSBuildProjectDirectory)` | Directory of the .csproj |\n| `$([MSBuild]::GetDirectoryNameOfFileAbove(...))` | Walk up to find a marker file |\n| `$([MSBuild]::NormalizePath(...))` | Combine and normalize path segments |\n\n---\n\n## AP-04: Restating SDK Defaults\n\n**Smell**: Properties set to values that the .NET SDK already provides by default.\n\n**Why it's bad**: Adds noise, hides intentional overrides, and makes it harder to identify what's actually customized. When defaults change in newer SDKs, the redundant properties may silently pin old behavior.\n\n```xml\n\u003C!-- BAD: All of these are already the default -->\n\u003CPropertyGroup>\n  \u003COutputType>Library\u003C\u002FOutputType>\n  \u003CEnableDefaultItems>true\u003C\u002FEnableDefaultItems>\n  \u003CEnableDefaultCompileItems>true\u003C\u002FEnableDefaultCompileItems>\n  \u003CRootNamespace>MyLib\u003C\u002FRootNamespace>       \u003C!-- matches project name -->\n  \u003CAssemblyName>MyLib\u003C\u002FAssemblyName>         \u003C!-- matches project name -->\n  \u003CAppendTargetFrameworkToOutputPath>true\u003C\u002FAppendTargetFrameworkToOutputPath>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Only non-default values -->\n\u003CPropertyGroup>\n  \u003CTargetFramework>net8.0\u003C\u002FTargetFramework>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## AP-05: Manual File Listing in SDK-Style Projects\n\n**Smell**: `\u003CCompile Include=\"File1.cs\" \u002F>`, `\u003CCompile Include=\"File2.cs\" \u002F>` in SDK-style projects.\n\n**Why it's bad**: SDK-style projects automatically glob `**\u002F*.cs` (and other file types). Explicit listing is redundant, creates merge conflicts, and new files may be accidentally missed if not added to the list.\n\n```xml\n\u003C!-- BAD -->\n\u003CItemGroup>\n  \u003CCompile Include=\"Program.cs\" \u002F>\n  \u003CCompile Include=\"Services\\MyService.cs\" \u002F>\n  \u003CCompile Include=\"Models\\User.cs\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Remove entirely — SDK includes all .cs files by default.\n     Only use Remove\u002FExclude when you need to opt out: -->\n\u003CItemGroup>\n  \u003CCompile Remove=\"LegacyCode\\**\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n**Exception**: Non-SDK-style (legacy) projects require explicit file includes. If migrating, see `msbuild-modernization` skill.\n\n**Exception (F# \u002F `.fsproj`)**: F# compilation is order-dependent — the compiler processes `\u003CCompile Include>` items sequentially and a file can only reference types\u002Fmodules declared in files listed above it. `.fsproj` files must therefore list every source file explicitly, in dependency order (utility\u002Fleaf modules at the top, the entry point such as `Program.fs` at the bottom). If a `.fsi` signature file is used, it must appear **immediately before** its companion `.fs` implementation file.\n\n---\n\n## AP-06: Using `\u003CReference>` with HintPath for NuGet Packages\n\n**Smell**: `\u003CReference Include=\"...\" HintPath=\"..\\packages\\SomePackage\\lib\\...\" \u002F>`\n\n**Why it's bad**: This is the legacy `packages.config` pattern. It doesn't support transitive dependencies, version conflict resolution, or automatic restore. The `packages\u002F` folder must be committed or restored separately.\n\n```xml\n\u003C!-- BAD -->\n\u003CItemGroup>\n  \u003CReference Include=\"Newtonsoft.Json\">\n    \u003CHintPath>..\\packages\\Newtonsoft.Json.13.0.3\\lib\\netstandard2.0\\Newtonsoft.Json.dll\u003C\u002FHintPath>\n  \u003C\u002FReference>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD -->\n\u003CItemGroup>\n  \u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n**Note**: `\u003CReference>` without HintPath is still valid for .NET Framework GAC assemblies like `WindowsBase`, `PresentationCore`, etc.\n\n---\n\n## AP-07: Missing `PrivateAssets=\"all\"` on Analyzer\u002FTool Packages\n\n**Smell**: `\u003CPackageReference Include=\"StyleCop.Analyzers\" Version=\"...\" \u002F>` without `PrivateAssets=\"all\"`.\n\n**Why it's bad**: Without `PrivateAssets=\"all\"`, analyzer and build-tool packages flow as transitive dependencies to consumers of your library. Consumers get unwanted analyzers or build-time tools they didn't ask for.\n\nSee [`references\u002Fprivate-assets.md`](references\u002Fprivate-assets.md) for BAD\u002FGOOD examples and the full list of packages that need this.\n\n---\n\n## AP-08: Copy-Pasted Properties Across Multiple .csproj Files\n\n**Smell**: The same `\u003CPropertyGroup>` block appears in 3+ project files.\n\n**Why it's bad**: Maintenance burden — a change must be made in every file. Inconsistencies creep in over time.\n\n```xml\n\u003C!-- BAD: Repeated in every .csproj -->\n\u003C!-- ProjectA.csproj, ProjectB.csproj, ProjectC.csproj all have: -->\n\u003CPropertyGroup>\n  \u003CNullable>enable\u003C\u002FNullable>\n  \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n  \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Define once in Directory.Build.props at the repo\u002Fsrc root -->\n\u003C!-- Directory.Build.props -->\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CNullable>enable\u003C\u002FNullable>\n    \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n    \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\nSee `directory-build-organization` skill for full guidance on structuring `Directory.Build.props` \u002F `Directory.Build.targets`.\n\n---\n\n## AP-09: Scattered Package Versions Without Central Package Management\n\n**Smell**: `\u003CPackageReference Include=\"X\" Version=\"1.2.3\" \u002F>` with different versions of the same package across projects.\n\n**Why it's bad**: Version drift — different projects use different versions of the same package, leading to runtime mismatches, unexpected behavior, or diamond dependency conflicts.\n\n```xml\n\u003C!-- BAD: Version specified in each project, can drift -->\n\u003C!-- ProjectA.csproj -->\n\u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.1\" \u002F>\n\u003C!-- ProjectB.csproj -->\n\u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n```\n\n**Fix:** Use Central Package Management. See [https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fnuget\u002Fconsume-packages\u002Fcentral-package-management](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fnuget\u002Fconsume-packages\u002Fcentral-package-management) for details.\n\n---\n\n## AP-10: Monolithic Targets (Too Much in One Target)\n\n**Smell**: A single `\u003CTarget>` with 50+ lines doing multiple unrelated things.\n\n**Why it's bad**: Can't skip individual steps via incremental build, hard to debug, hard to extend, and the target name becomes meaningless.\n\n```xml\n\u003C!-- BAD -->\n\u003CTarget Name=\"PrepareRelease\" BeforeTargets=\"Build\">\n  \u003CWriteLinesToFile File=\"version.txt\" Lines=\"$(Version)\" Overwrite=\"true\" \u002F>\n  \u003CCopy SourceFiles=\"LICENSE\" DestinationFolder=\"$(OutputPath)\" \u002F>\n  \u003CExec Command=\"signtool sign \u002Ff cert.pfx $(OutputPath)*.dll\" \u002F>\n  \u003CMakeDir Directories=\"$(OutputPath)docs\" \u002F>\n  \u003CCopy SourceFiles=\"@(DocFiles)\" DestinationFolder=\"$(OutputPath)docs\" \u002F>\n  \u003C!-- ... 30 more lines ... -->\n\u003C\u002FTarget>\n\n\u003C!-- GOOD: Single-responsibility targets -->\n\u003CTarget Name=\"WriteVersionFile\" BeforeTargets=\"CoreCompile\"\n        Inputs=\"$(MSBuildProjectFile)\" Outputs=\"$(IntermediateOutputPath)version.txt\">\n  \u003CWriteLinesToFile File=\"$(IntermediateOutputPath)version.txt\" Lines=\"$(Version)\" Overwrite=\"true\" \u002F>\n\u003C\u002FTarget>\n\n\u003CTarget Name=\"CopyLicense\" AfterTargets=\"Build\">\n  \u003CCopy SourceFiles=\"LICENSE\" DestinationFolder=\"$(OutputPath)\" SkipUnchangedFiles=\"true\" \u002F>\n\u003C\u002FTarget>\n\n\u003CTarget Name=\"SignAssemblies\" AfterTargets=\"Build\" DependsOnTargets=\"CopyLicense\"\n        Condition=\"'$(SignAssemblies)' == 'true'\">\n  \u003CExec Command=\"signtool sign \u002Ff cert.pfx %(AssemblyFiles.Identity)\" \u002F>\n\u003C\u002FTarget>\n```\n\n---\n\n## AP-11: Custom Targets Missing `Inputs` and `Outputs`\n\n**Smell**: `\u003CTarget Name=\"MyTarget\" BeforeTargets=\"Build\">` with no `Inputs` \u002F `Outputs` attributes.\n\n**Why it's bad**: The target runs on every build, even when nothing changed. This defeats incremental build and slows down no-op builds.\n\nSee [`references\u002Fincremental-build-inputs-outputs.md`](references\u002Fincremental-build-inputs-outputs.md) for BAD\u002FGOOD examples and the full pattern including FileWrites registration.\n\nSee `incremental-build` skill for deep guidance on Inputs\u002FOutputs, FileWrites, and up-to-date checks.\n\n---\n\n## AP-12: Setting Defaults in .targets Instead of .props\n\n**Smell**: `\u003CPropertyGroup>` with default values inside a `.targets` file.\n\n**Why it's bad**: `.targets` files are imported late (after project files). By the time they set defaults, other `.targets` files may have already used the empty\u002Fundefined value. `.props` files are imported early and are the correct place for defaults.\n\n```xml\n\u003C!-- BAD: custom.targets -->\n\u003CPropertyGroup>\n  \u003CMyToolVersion>2.0\u003C\u002FMyToolVersion>\n\u003C\u002FPropertyGroup>\n\u003CTarget Name=\"RunMyTool\">\n  \u003CExec Command=\"mytool --version $(MyToolVersion)\" \u002F>\n\u003C\u002FTarget>\n\n\u003C!-- GOOD: Split into .props (defaults) + .targets (logic) -->\n\u003C!-- custom.props (imported early) -->\n\u003CPropertyGroup>\n  \u003CMyToolVersion Condition=\"'$(MyToolVersion)' == ''\">2.0\u003C\u002FMyToolVersion>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- custom.targets (imported late) -->\n\u003CTarget Name=\"RunMyTool\">\n  \u003CExec Command=\"mytool --version $(MyToolVersion)\" \u002F>\n\u003C\u002FTarget>\n```\n\n**Rule**: `.props` = defaults and settings (evaluated early). `.targets` = build logic and targets (evaluated late).\n\n---\n\n## AP-13: Import Without `Exists()` Guard\n\n**Smell**: `\u003CImport Project=\"some-file.props\" \u002F>` without a `Condition=\"Exists('...')\"` check.\n\n**Why it's bad**: If the file doesn't exist (not yet created, wrong path, deleted), the build fails with a confusing error. Optional imports should always be guarded.\n\n```xml\n\u003C!-- BAD -->\n\u003CImport Project=\"$(RepoRoot)eng\\custom.props\" \u002F>\n\n\u003C!-- GOOD: Guard optional imports -->\n\u003CImport Project=\"$(RepoRoot)eng\\custom.props\" Condition=\"Exists('$(RepoRoot)eng\\custom.props')\" \u002F>\n\n\u003C!-- ALSO GOOD: Sdk attribute imports don't need guards (they're required by design) -->\n\u003CProject Sdk=\"Microsoft.NET.Sdk\">\n```\n\n**Exception — required imports**: Imports that are *required* for the build to work correctly should fail fast — don't guard those. Guard imports that are optional or environment-specific (e.g., local developer overrides, CI-specific settings).\n\n**Exception — NuGet package forwarders**: `.props`\u002F`.targets` files inside a NuGet package's per-TFM `build\u002F` or `buildTransitive\u002F` folder routinely import a sibling file under `buildTransitive\u002F\u003Ctfm>\u002F…` without an `Exists()` guard. These are a **package contract**: the target file is guaranteed to be present in the restored package, even if it doesn't appear in the source tree at that relative path. The package layout is typically produced by:\n\n- A custom `.nuspec` with per-TFM `\u003Cfile>` entries — e.g. `\u003Cfile src=\"buildTransitive\\common\\MyAdapter.props\" target=\"buildTransitive\\net8.0\\MyAdapter.props\" \u002F>` — that copy files from a single source folder (such as `buildTransitive\u002Fcommon\u002F`) into per-TFM subfolders at pack time, or\n- `\u003CNone Update=\"...\">` \u002F `\u003CContent Include=\"...\">` items in the `.csproj` with a per-TFM `\u003CPackagePath>` (e.g. `\u003CPackagePath>buildTransitive\u002Fnet8.0\u002F\u003C\u002FPackagePath>`), declared once per target TFM, or\n- SDK conventions (e.g. `IncludeBuildOutput`, `BuildOutputTargetFolder`) that place built outputs under `build\u002F\u003Ctfm>\u002F`.\n\nBefore flagging an unguarded `\u003CImport>` inside a `build\u002F` or `buildTransitive\u002F` folder, **resolve it against the packed layout** — read every `*.nuspec` in the project directory **and its immediate parent directory** (shared nuspecs are common in mono-repos; do not walk further up), and any `\u003CPackagePath>` metadata on `\u003CNone>`\u002F`\u003CContent>` items in the `.csproj`. Only flag if the target path is missing from **both** the source tree *and* the projected package layout. The `dotnet-msbuild\u002Fextension-points` skill — *Source tree vs packed layout* — documents the full cross-check procedure.\n\n**Forwarding `buildTransitive\u002F` → `build\u002F`:** forward through the sibling `build\u002F*.props` \u002F `build\u002F*.targets` file (not directly to `buildMultiTargeting\u002F`); when `build\u002F` is per-TFM (`build\u002F\u003Ctfm>\u002F`), include the TFM segment derived from the file's own folder (not `$(TargetFramework)`), or transitive consumers hit `MSB4019`. See the `extension-points` skill — *Forwarding chain* — for the rule and derivation expression.\n\n---\n\n## AP-14: Backslashes in Paths — Where It Matters\n\n**Smell**: Backslash path separators in `.props`\u002F`.targets` files meant to run cross-platform.\n\n**Where this is a real bug (? Error)** — paths that MSBuild does **not** route through its path normalizer:\n\n- Raw shell strings inside `\u003CExec Command=\"...\\tools\\foo.exe ...\" \u002F>` — passed verbatim to `bash`\u002F`sh` on Unix, which treats `\\` as an escape.\n- Backslash-delimited paths inside CDATA blocks, embedded in source files written by `\u003CWriteLinesToFile>`, or constructed for non-MSBuild consumers (custom scripts, response files, environment variables).\n- Paths handed to custom tasks that call OS file APIs directly without going through MSBuild path utilities.\n\n**Where this is only a style preference (? Style)** — paths that go through MSBuild's evaluator (`\u003CImport Project=\"...\">`, file-path properties consumed by built-in tasks like `\u003CCopy>`\u002F`\u003CMakeDir>`\u002F`\u003CDelete>`, item `Include=`\u002F`Exclude=` globs):\n\nMSBuild's evaluator normalizes `\\` → `\u002F` on Unix-like systems before resolving the path. See `FileUtilities.MaybeAdjustFilePath` and `ConvertToUnixSlashes` in [`microsoft\u002Fmsbuild` `src\u002FFramework\u002FFileUtilities.cs`](https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild\u002Fblob\u002Fmain\u002Fsrc\u002FFramework\u002FFileUtilities.cs). So `\u003CImport Project=\"$(MSBuildThisFileDirectory)..\\..\\build\\common.props\" \u002F>` resolves correctly on Linux\u002FmacOS today. Forward slashes are still **preferred for consistency**, but the import will not break and existing backslash-style imports should not be flagged as ? **Error**.\n\n```xml\n\u003C!-- ? Error: \\ in raw shell string breaks on Linux\u002FmacOS -->\n\u003CExec Command=\"$(MSBuildThisFileDirectory)tools\\release\\sign.exe $(OutputPath)\" \u002F>\n\n\u003C!-- ? Style: \\ in Import is normalized on Unix, but \u002F is nicer -->\n\u003CImport Project=\"$(MSBuildThisFileDirectory)..\\..\\build\\common.props\" \u002F>\n\n\u003C!-- ✅ Recommended in new code -->\n\u003CImport Project=\"$(MSBuildThisFileDirectory)..\u002F..\u002Fbuild\u002Fcommon.props\" \u002F>\n```\n\n**Verification rule**: Before flagging a backslash path as ? **Error**, ask *\"does this string flow through MSBuild's evaluator, or is it handed verbatim to a non-MSBuild consumer?\"* Only the second case is a correctness defect.\n\n**Note**: `$(MSBuildThisFileDirectory)` already ends with a platform-appropriate separator, so `$(MSBuildThisFileDirectory)tools\u002Fmytool` works on both platforms.\n\n---\n\n## AP-15: Unconditional Property Override in Multiple Scopes\n\n**Smell**: A property set unconditionally in both `Directory.Build.props` and a `.csproj` — last write wins silently.\n\n**Why it's bad**: Hard to trace which value is actually used. Makes the build fragile and confusing for anyone reading the project files.\n\n```xml\n\u003C!-- BAD: Directory.Build.props sets it, csproj silently overrides -->\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003COutputPath>bin\\custom\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\u003C!-- MyProject.csproj -->\n\u003CPropertyGroup>\n  \u003COutputPath>bin\\other\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Use a condition so overrides are intentional -->\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003COutputPath Condition=\"'$(OutputPath)' == ''\">bin\\custom\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\u003C!-- MyProject.csproj can now intentionally override or leave the default -->\n```\n\n---\n\nFor additional anti-patterns (AP-16 through AP-23) and a quick-reference checklist, see [additional-antipatterns.md](references\u002Fadditional-antipatterns.md).\n","# MSBuild Anti-Pattern Catalog\n\nA numbered catalog of common MSBuild anti-patterns. Each entry follows the format:\n\n- **Smell**: What to look for\n- **Why it's bad**: Impact on builds, maintainability, or correctness\n- **Fix**: Concrete transformation\n\nUse this catalog when scanning project files for improvements.\n\n## Review output contract\n\nFor review, audit, maintainability, or correctness-risk requests:\n\n1. Do not edit files unless the user explicitly asks for fixes.\n2. Return prioritized findings grounded in the supplied file, with impact and a targeted recommendation.\n3. Separate confirmed defects from conditional risks and already-correct patterns.\n4. Keep the final answer as the review; do not replace it with a terse summary of changes.\n\n---\n\n## AP-01: `\u003CExec>` for Operations That Have Built-in Tasks\n\n**Smell**: `\u003CExec Command=\"mkdir ...\" \u002F>`, `\u003CExec Command=\"copy ...\" \u002F>`, `\u003CExec Command=\"del ...\" \u002F>`\n\n**Why it's bad**: Built-in tasks are cross-platform, support incremental build, emit structured logging, and handle errors consistently. `\u003CExec>` is opaque to MSBuild.\n\n```xml\n\u003C!-- BAD -->\n\u003CTarget Name=\"PrepareOutput\">\n  \u003CExec Command=\"mkdir $(OutputPath)logs\" \u002F>\n  \u003CExec Command=\"copy config.json $(OutputPath)\" \u002F>\n  \u003CExec Command=\"del $(IntermediateOutputPath)*.tmp\" \u002F>\n\u003C\u002FTarget>\n\n\u003C!-- GOOD -->\n\u003CTarget Name=\"PrepareOutput\">\n  \u003CMakeDir Directories=\"$(OutputPath)logs\" \u002F>\n  \u003CCopy SourceFiles=\"config.json\" DestinationFolder=\"$(OutputPath)\" \u002F>\n  \u003CDelete Files=\"@(TempFiles)\" \u002F>\n\u003C\u002FTarget>\n```\n\n**Built-in task alternatives:**\n\n| Shell Command | MSBuild Task |\n|--------------|--------------|\n| `mkdir` | `\u003CMakeDir>` |\n| `copy` \u002F `cp` | `\u003CCopy>` |\n| `del` \u002F `rm` | `\u003CDelete>` |\n| `move` \u002F `mv` | `\u003CMove>` |\n| `echo text > file` | `\u003CWriteLinesToFile>` |\n| `touch` | `\u003CTouch>` |\n| `xcopy \u002Fs` | `\u003CCopy>` with item globs |\n\n---\n\n## AP-02: Unquoted Condition Expressions\n\n**Smell**: `Condition=\"$(Foo) == Bar\"` — either side of a comparison is unquoted.\n\n**Why it's bad**: If the property is empty or contains spaces\u002Fspecial characters, the condition evaluates incorrectly or throws a parse error. MSBuild requires single-quoted strings for reliable comparisons.\n\n```xml\n\u003C!-- BAD -->\n\u003CPropertyGroup Condition=\"$(Configuration) == Release\">\n  \u003COptimize>true\u003C\u002FOptimize>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD -->\n\u003CPropertyGroup Condition=\"'$(Configuration)' == 'Release'\">\n  \u003COptimize>true\u003C\u002FOptimize>\n\u003C\u002FPropertyGroup>\n```\n\n**Rule**: Always quote **both** sides of `==` and `!=` comparisons with single quotes.\n\n---\n\n## AP-03: Hardcoded Absolute Paths\n\n**Smell**: Paths like `C:\\tools\\`, `D:\\packages\\`, `\u002Fusr\u002Flocal\u002Fbin\u002F` in project files.\n\n**Why it's bad**: Breaks on other machines, CI environments, and other operating systems. Not relocatable.\n\n```xml\n\u003C!-- BAD -->\n\u003CPropertyGroup>\n  \u003CToolPath>C:\\tools\\mytool\\mytool.exe\u003C\u002FToolPath>\n\u003C\u002FPropertyGroup>\n\u003CImport Project=\"C:\\repos\\shared\\common.props\" \u002F>\n\n\u003C!-- GOOD -->\n\u003CPropertyGroup>\n  \u003CToolPath>$(MSBuildThisFileDirectory)tools\\mytool\\mytool.exe\u003C\u002FToolPath>\n\u003C\u002FPropertyGroup>\n\u003CImport Project=\"$(RepoRoot)eng\\common.props\" \u002F>\n```\n\n**Preferred path properties:**\n\n| Property | Meaning |\n|----------|---------|\n| `$(MSBuildThisFileDirectory)` | Directory of the current .props\u002F.targets file |\n| `$(MSBuildProjectDirectory)` | Directory of the .csproj |\n| `$([MSBuild]::GetDirectoryNameOfFileAbove(...))` | Walk up to find a marker file |\n| `$([MSBuild]::NormalizePath(...))` | Combine and normalize path segments |\n\n---\n\n## AP-04: Restating SDK Defaults\n\n**Smell**: Properties set to values that the .NET SDK already provides by default.\n\n**Why it's bad**: Adds noise, hides intentional overrides, and makes it harder to identify what's actually customized. When defaults change in newer SDKs, the redundant properties may silently pin old behavior.\n\n```xml\n\u003C!-- BAD: All of these are already the default -->\n\u003CPropertyGroup>\n  \u003COutputType>Library\u003C\u002FOutputType>\n  \u003CEnableDefaultItems>true\u003C\u002FEnableDefaultItems>\n  \u003CEnableDefaultCompileItems>true\u003C\u002FEnableDefaultCompileItems>\n  \u003CRootNamespace>MyLib\u003C\u002FRootNamespace>       \u003C!-- matches project name -->\n  \u003CAssemblyName>MyLib\u003C\u002FAssemblyName>         \u003C!-- matches project name -->\n  \u003CAppendTargetFrameworkToOutputPath>true\u003C\u002FAppendTargetFrameworkToOutputPath>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Only non-default values -->\n\u003CPropertyGroup>\n  \u003CTargetFramework>net8.0\u003C\u002FTargetFramework>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## AP-05: Manual File Listing in SDK-Style Projects\n\n**Smell**: `\u003CCompile Include=\"File1.cs\" \u002F>`, `\u003CCompile Include=\"File2.cs\" \u002F>` in SDK-style projects.\n\n**Why it's bad**: SDK-style projects automatically glob `**\u002F*.cs` (and other file types). Explicit listing is redundant, creates merge conflicts, and new files may be accidentally missed if not added to the list.\n\n```xml\n\u003C!-- BAD -->\n\u003CItemGroup>\n  \u003CCompile Include=\"Program.cs\" \u002F>\n  \u003CCompile Include=\"Services\\MyService.cs\" \u002F>\n  \u003CCompile Include=\"Models\\User.cs\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Remove entirely — SDK includes all .cs files by default.\n     Only use Remove\u002FExclude when you need to opt out: -->\n\u003CItemGroup>\n  \u003CCompile Remove=\"LegacyCode\\**\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n**Exception**: Non-SDK-style (legacy) projects require explicit file includes. If migrating, see `msbuild-modernization` skill.\n\n**Exception (F# \u002F `.fsproj`)**: F# compilation is order-dependent — the compiler processes `\u003CCompile Include>` items sequentially and a file can only reference types\u002Fmodules declared in files listed above it. `.fsproj` files must therefore list every source file explicitly, in dependency order (utility\u002Fleaf modules at the top, the entry point such as `Program.fs` at the bottom). If a `.fsi` signature file is used, it must appear **immediately before** its companion `.fs` implementation file.\n\n---\n\n## AP-06: Using `\u003CReference>` with HintPath for NuGet Packages\n\n**Smell**: `\u003CReference Include=\"...\" HintPath=\"..\\packages\\SomePackage\\lib\\...\" \u002F>`\n\n**Why it's bad**: This is the legacy `packages.config` pattern. It doesn't support transitive dependencies, version conflict resolution, or automatic restore. The `packages\u002F` folder must be committed or restored separately.\n\n```xml\n\u003C!-- BAD -->\n\u003CItemGroup>\n  \u003CReference Include=\"Newtonsoft.Json\">\n    \u003CHintPath>..\\packages\\Newtonsoft.Json.13.0.3\\lib\\netstandard2.0\\Newtonsoft.Json.dll\u003C\u002FHintPath>\n  \u003C\u002FReference>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD -->\n\u003CItemGroup>\n  \u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n**Note**: `\u003CReference>` without HintPath is still valid for .NET Framework GAC assemblies like `WindowsBase`, `PresentationCore`, etc.\n\n---\n\n## AP-07: Missing `PrivateAssets=\"all\"` on Analyzer\u002FTool Packages\n\n**Smell**: `\u003CPackageReference Include=\"StyleCop.Analyzers\" Version=\"...\" \u002F>` without `PrivateAssets=\"all\"`.\n\n**Why it's bad**: Without `PrivateAssets=\"all\"`, analyzer and build-tool packages flow as transitive dependencies to consumers of your library. Consumers get unwanted analyzers or build-time tools they didn't ask for.\n\nSee [`references\u002Fprivate-assets.md`](references\u002Fprivate-assets.md) for BAD\u002FGOOD examples and the full list of packages that need this.\n\n---\n\n## AP-08: Copy-Pasted Properties Across Multiple .csproj Files\n\n**Smell**: The same `\u003CPropertyGroup>` block appears in 3+ project files.\n\n**Why it's bad**: Maintenance burden — a change must be made in every file. Inconsistencies creep in over time.\n\n```xml\n\u003C!-- BAD: Repeated in every .csproj -->\n\u003C!-- ProjectA.csproj, ProjectB.csproj, ProjectC.csproj all have: -->\n\u003CPropertyGroup>\n  \u003CNullable>enable\u003C\u002FNullable>\n  \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n  \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Define once in Directory.Build.props at the repo\u002Fsrc root -->\n\u003C!-- Directory.Build.props -->\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CNullable>enable\u003C\u002FNullable>\n    \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n    \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\nSee `directory-build-organization` skill for full guidance on structuring `Directory.Build.props` \u002F `Directory.Build.targets`.\n\n---\n\n## AP-09: Scattered Package Versions Without Central Package Management\n\n**Smell**: `\u003CPackageReference Include=\"X\" Version=\"1.2.3\" \u002F>` with different versions of the same package across projects.\n\n**Why it's bad**: Version drift — different projects use different versions of the same package, leading to runtime mismatches, unexpected behavior, or diamond dependency conflicts.\n\n```xml\n\u003C!-- BAD: Version specified in each project, can drift -->\n\u003C!-- ProjectA.csproj -->\n\u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.1\" \u002F>\n\u003C!-- ProjectB.csproj -->\n\u003CPackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n```\n\n**Fix:** Use Central Package Management. See [https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fnuget\u002Fconsume-packages\u002Fcentral-package-management](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fnuget\u002Fconsume-packages\u002Fcentral-package-management) for details.\n\n---\n\n## AP-10: Monolithic Targets (Too Much in One Target)\n\n**Smell**: A single `\u003CTarget>` with 50+ lines doing multiple unrelated things.\n\n**Why it's bad**: Can't skip individual steps via incremental build, hard to debug, hard to extend, and the target name becomes meaningless.\n\n```xml\n\u003C!-- BAD -->\n\u003CTarget Name=\"PrepareRelease\" BeforeTargets=\"Build\">\n  \u003CWriteLinesToFile File=\"version.txt\" Lines=\"$(Version)\" Overwrite=\"true\" \u002F>\n  \u003CCopy SourceFiles=\"LICENSE\" DestinationFolder=\"$(OutputPath)\" \u002F>\n  \u003CExec Command=\"signtool sign \u002Ff cert.pfx $(OutputPath)*.dll\" \u002F>\n  \u003CMakeDir Directories=\"$(OutputPath)docs\" \u002F>\n  \u003CCopy SourceFiles=\"@(DocFiles)\" DestinationFolder=\"$(OutputPath)docs\" \u002F>\n  \u003C!-- ... 30 more lines ... -->\n\u003C\u002FTarget>\n\n\u003C!-- GOOD: Single-responsibility targets -->\n\u003CTarget Name=\"WriteVersionFile\" BeforeTargets=\"CoreCompile\"\n        Inputs=\"$(MSBuildProjectFile)\" Outputs=\"$(IntermediateOutputPath)version.txt\">\n  \u003CWriteLinesToFile File=\"$(IntermediateOutputPath)version.txt\" Lines=\"$(Version)\" Overwrite=\"true\" \u002F>\n\u003C\u002FTarget>\n\n\u003CTarget Name=\"CopyLicense\" AfterTargets=\"Build\">\n  \u003CCopy SourceFiles=\"LICENSE\" DestinationFolder=\"$(OutputPath)\" SkipUnchangedFiles=\"true\" \u002F>\n\u003C\u002FTarget>\n\n\u003CTarget Name=\"SignAssemblies\" AfterTargets=\"Build\" DependsOnTargets=\"CopyLicense\"\n        Condition=\"'$(SignAssemblies)' == 'true'\">\n  \u003CExec Command=\"signtool sign \u002Ff cert.pfx %(AssemblyFiles.Identity)\" \u002F>\n\u003C\u002FTarget>\n```\n\n---\n\n## AP-11: Custom Targets Missing `Inputs` and `Outputs`\n\n**Smell**: `\u003CTarget Name=\"MyTarget\" BeforeTargets=\"Build\">` with no `Inputs` \u002F `Outputs` attributes.\n\n**Why it's bad**: The target runs on every build, even when nothing changed. This defeats incremental build and slows down no-op builds.\n\nSee [`references\u002Fincremental-build-inputs-outputs.md`](references\u002Fincremental-build-inputs-outputs.md) for BAD\u002FGOOD examples and the full pattern including FileWrites registration.\n\nSee `incremental-build` skill for deep guidance on Inputs\u002FOutputs, FileWrites, and up-to-date checks.\n\n---\n\n## AP-12: Setting Defaults in .targets Instead of .props\n\n**Smell**: `\u003CPropertyGroup>` with default values inside a `.targets` file.\n\n**Why it's bad**: `.targets` files are imported late (after project files). By the time they set defaults, other `.targets` files may have already used the empty\u002Fundefined value. `.props` files are imported early and are the correct place for defaults.\n\n```xml\n\u003C!-- BAD: custom.targets -->\n\u003CPropertyGroup>\n  \u003CMyToolVersion>2.0\u003C\u002FMyToolVersion>\n\u003C\u002FPropertyGroup>\n\u003CTarget Name=\"RunMyTool\">\n  \u003CExec Command=\"mytool --version $(MyToolVersion)\" \u002F>\n\u003C\u002FTarget>\n\n\u003C!-- GOOD: Split into .props (defaults) + .targets (logic) -->\n\u003C!-- custom.props (imported early) -->\n\u003CPropertyGroup>\n  \u003CMyToolVersion Condition=\"'$(MyToolVersion)' == ''\">2.0\u003C\u002FMyToolVersion>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- custom.targets (imported late) -->\n\u003CTarget Name=\"RunMyTool\">\n  \u003CExec Command=\"mytool --version $(MyToolVersion)\" \u002F>\n\u003C\u002FTarget>\n```\n\n**Rule**: `.props` = defaults and settings (evaluated early). `.targets` = build logic and targets (evaluated late).\n\n---\n\n## AP-13: Import Without `Exists()` Guard\n\n**Smell**: `\u003CImport Project=\"some-file.props\" \u002F>` without a `Condition=\"Exists('...')\"` check.\n\n**Why it's bad**: If the file doesn't exist (not yet created, wrong path, deleted), the build fails with a confusing error. Optional imports should always be guarded.\n\n```xml\n\u003C!-- BAD -->\n\u003CImport Project=\"$(RepoRoot)eng\\custom.props\" \u002F>\n\n\u003C!-- GOOD: Guard optional imports -->\n\u003CImport Project=\"$(RepoRoot)eng\\custom.props\" Condition=\"Exists('$(RepoRoot)eng\\custom.props')\" \u002F>\n\n\u003C!-- ALSO GOOD: Sdk attribute imports don't need guards (they're required by design) -->\n\u003CProject Sdk=\"Microsoft.NET.Sdk\">\n```\n\n**Exception — required imports**: Imports that are *required* for the build to work correctly should fail fast — don't guard those. Guard imports that are optional or environment-specific (e.g., local developer overrides, CI-specific settings).\n\n**Exception — NuGet package forwarders**: `.props`\u002F`.targets` files inside a NuGet package's per-TFM `build\u002F` or `buildTransitive\u002F` folder routinely import a sibling file under `buildTransitive\u002F\u003Ctfm>\u002F…` without an `Exists()` guard. These are a **package contract**: the target file is guaranteed to be present in the restored package, even if it doesn't appear in the source tree at that relative path. The package layout is typically produced by:\n\n- A custom `.nuspec` with per-TFM `\u003Cfile>` entries — e.g. `\u003Cfile src=\"buildTransitive\\common\\MyAdapter.props\" target=\"buildTransitive\\net8.0\\MyAdapter.props\" \u002F>` — that copy files from a single source folder (such as `buildTransitive\u002Fcommon\u002F`) into per-TFM subfolders at pack time, or\n- `\u003CNone Update=\"...\">` \u002F `\u003CContent Include=\"...\">` items in the `.csproj` with a per-TFM `\u003CPackagePath>` (e.g. `\u003CPackagePath>buildTransitive\u002Fnet8.0\u002F\u003C\u002FPackagePath>`), declared once per target TFM, or\n- SDK conventions (e.g. `IncludeBuildOutput`, `BuildOutputTargetFolder`) that place built outputs under `build\u002F\u003Ctfm>\u002F`.\n\nBefore flagging an unguarded `\u003CImport>` inside a `build\u002F` or `buildTransitive\u002F` folder, **resolve it against the packed layout** — read every `*.nuspec` in the project directory **and its immediate parent directory** (shared nuspecs are common in mono-repos; do not walk further up), and any `\u003CPackagePath>` metadata on `\u003CNone>`\u002F`\u003CContent>` items in the `.csproj`. Only flag if the target path is missing from **both** the source tree *and* the projected package layout. The `dotnet-msbuild\u002Fextension-points` skill — *Source tree vs packed layout* — documents the full cross-check procedure.\n\n**Forwarding `buildTransitive\u002F` → `build\u002F`:** forward through the sibling `build\u002F*.props` \u002F `build\u002F*.targets` file (not directly to `buildMultiTargeting\u002F`); when `build\u002F` is per-TFM (`build\u002F\u003Ctfm>\u002F`), include the TFM segment derived from the file's own folder (not `$(TargetFramework)`), or transitive consumers hit `MSB4019`. See the `extension-points` skill — *Forwarding chain* — for the rule and derivation expression.\n\n---\n\n## AP-14: Backslashes in Paths — Where It Matters\n\n**Smell**: Backslash path separators in `.props`\u002F`.targets` files meant to run cross-platform.\n\n**Where this is a real bug (? Error)** — paths that MSBuild does **not** route through its path normalizer:\n\n- Raw shell strings inside `\u003CExec Command=\"...\\tools\\foo.exe ...\" \u002F>` — passed verbatim to `bash`\u002F`sh` on Unix, which treats `\\` as an escape.\n- Backslash-delimited paths inside CDATA blocks, embedded in source files written by `\u003CWriteLinesToFile>`, or constructed for non-MSBuild consumers (custom scripts, response files, environment variables).\n- Paths handed to custom tasks that call OS file APIs directly without going through MSBuild path utilities.\n\n**Where this is only a style preference (? Style)** — paths that go through MSBuild's evaluator (`\u003CImport Project=\"...\">`, file-path properties consumed by built-in tasks like `\u003CCopy>`\u002F`\u003CMakeDir>`\u002F`\u003CDelete>`, item `Include=`\u002F`Exclude=` globs):\n\nMSBuild's evaluator normalizes `\\` → `\u002F` on Unix-like systems before resolving the path. See `FileUtilities.MaybeAdjustFilePath` and `ConvertToUnixSlashes` in [`microsoft\u002Fmsbuild` `src\u002FFramework\u002FFileUtilities.cs`](https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fmsbuild\u002Fblob\u002Fmain\u002Fsrc\u002FFramework\u002FFileUtilities.cs). So `\u003CImport Project=\"$(MSBuildThisFileDirectory)..\\..\\build\\common.props\" \u002F>` resolves correctly on Linux\u002FmacOS today. Forward slashes are still **preferred for consistency**, but the import will not break and existing backslash-style imports should not be flagged as ? **Error**.\n\n```xml\n\u003C!-- ? Error: \\ in raw shell string breaks on Linux\u002FmacOS -->\n\u003CExec Command=\"$(MSBuildThisFileDirectory)tools\\release\\sign.exe $(OutputPath)\" \u002F>\n\n\u003C!-- ? Style: \\ in Import is normalized on Unix, but \u002F is nicer -->\n\u003CImport Project=\"$(MSBuildThisFileDirectory)..\\..\\build\\common.props\" \u002F>\n\n\u003C!-- ✅ Recommended in new code -->\n\u003CImport Project=\"$(MSBuildThisFileDirectory)..\u002F..\u002Fbuild\u002Fcommon.props\" \u002F>\n```\n\n**Verification rule**: Before flagging a backslash path as ? **Error**, ask *\"does this string flow through MSBuild's evaluator, or is it handed verbatim to a non-MSBuild consumer?\"* Only the second case is a correctness defect.\n\n**Note**: `$(MSBuildThisFileDirectory)` already ends with a platform-appropriate separator, so `$(MSBuildThisFileDirectory)tools\u002Fmytool` works on both platforms.\n\n---\n\n## AP-15: Unconditional Property Override in Multiple Scopes\n\n**Smell**: A property set unconditionally in both `Directory.Build.props` and a `.csproj` — last write wins silently.\n\n**Why it's bad**: Hard to trace which value is actually used. Makes the build fragile and confusing for anyone reading the project files.\n\n```xml\n\u003C!-- BAD: Directory.Build.props sets it, csproj silently overrides -->\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003COutputPath>bin\\custom\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\u003C!-- MyProject.csproj -->\n\u003CPropertyGroup>\n  \u003COutputPath>bin\\other\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\n\u003C!-- GOOD: Use a condition so overrides are intentional -->\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003COutputPath Condition=\"'$(OutputPath)' == ''\">bin\\custom\\\u003C\u002FOutputPath>\n\u003C\u002FPropertyGroup>\n\u003C!-- MyProject.csproj can now intentionally override or leave the default -->\n```\n\n---\n\nFor additional anti-patterns (AP-16 through AP-23) and a quick-reference checklist, see [additional-antipatterns.md](references\u002Fadditional-antipatterns.md).\n",{"name":5,"license":15,"description":7},"main","497cc9aba79a931ac6fb8d36a48cc22fe3d6d74b","catalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns",41,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills","https:\u002F\u002Fskills.managed-code.com","https:\u002F\u002Fgithub.com\u002Fmanagedcode","https:\u002F\u002Fwww.managed-code.com","Open Source Community for .NET Developers: Reliable, Actively Maintained, and Community-Driven. Made in Ukraine 🇺🇦 with ❤️","2026-11-14 19:05:44",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add managedcode\u002Fdotnet-skills --skill msbuild-antipatterns",{"tool":64,"command":65},"bunx","bunx skills add managedcode\u002Fdotnet-skills --skill msbuild-antipatterns",{"tool":67,"command":68},"pnpm","pnpm dlx skills add managedcode\u002Fdotnet-skills --skill msbuild-antipatterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002FSKILL.md",true,[72,78,82,86],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"manifest.json","REFERENCE","参考文档",137,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002Fmanifest.json",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fadditional-antipatterns.md",19271,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002Freferences\u002Fadditional-antipatterns.md",{"path":83,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fincremental-build-inputs-outputs.md",1561,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002Freferences\u002Fincremental-build-inputs-outputs.md",{"path":87,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fprivate-assets.md",1041,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTools\u002FOfficial-DotNet-MSBuild\u002Fskills\u002Fmsbuild-antipatterns\u002Freferences\u002Fprivate-assets.md",[91,127,151,182,192,218],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":107,"publishedAt":43},"01M6DYQE1Y9FHAQHEDTVFQ3447","xtwitter-scraper","Use XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API client usage; modeling API-key configuration, pagination, binary exports, raw responses, retries, and webhook\u002Fevent flows in .NET. DO NOT USE FOR: unrelated stacks; direct browser automation; generic social-media strategy; or code that does not call Xquik. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FXTwitterScraper\u002Fskills\u002Fxtwitter-scraper\u002FSKILL.md",[97,102],{"categoryNo":98,"categoryName":99,"taxonomyType":100,"taxonomyTypeDesc":101},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":103,"categoryName":104,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,32,123,124,125,126],"xtwitter scraper","browser automation","workflows","run","code","browser","search","repository","api","Media","api client","access","edit","unrelated","webhooks","social","commands","modeling","webhook",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":139,"publishedAt":43},"01M6DYQ9S4PE1H6G8MCH9T21HR","sep","Use Sep for high-performance separated-value parsing and writing in .NET, including delimiter inference, explicit parser\u002Fwriter options, and low-allocation row\u002Fcolumn workflows. USE FOR: delimited data needs are performance-sensitive and allocation-aware; project needs explicit control over separator inference, escaping, trimming, and header behavior;. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FSep\u002Fskills\u002Fsep\u002FSKILL.md",[133,136],{"categoryNo":134,"categoryName":135,"taxonomyType":100,"taxonomyTypeDesc":101},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":137,"categoryName":138,"taxonomyType":105,"taxonomyTypeDesc":106},"01JBSEEDCAT000000000000036","内容创作者",[129,140,141,110,142,111,115,143,144,145,120,146,121,32,147,148,149,30,124,150],"writing","performance","tasks","data","parsing","parser","context","do","writer","options","high-performance",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":43},"01M6DZS2DNEPXCGGF6SSCW6G5V","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fwebgpu-claude-skill\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,22],"webgpu","threejs","webgpu threejs tsl","setup","shaders","gpu","integration","applications","js","node","syntax","guide","use","language","three","compute","post","processing","with","renderer","for","materials","wgsl","effects",{"skillNo":183,"name":184,"nameZh":6,"description":185,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":186,"categories":187,"keywords":188,"publishedAt":43},"01M6DZS0BQXW2B56A289XF1X76","roslynk","Use Roslynk for semantic inspection and edits of *.cs, *.razor and *.cshtml solution files.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Froslynk\u002Fskills\u002Froslynk\u002FSKILL.md",[],[184,170,32,189,190,178,191],"semantic","razor","inspection",{"skillNo":193,"name":194,"nameZh":6,"description":195,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":196,"categories":197,"keywords":198,"publishedAt":43},"01M6DZRW6MEJCVW80K3S4XV60K","system-text-json-net11","Imperative guidance for the System.Text.Json APIs added in .NET 11: the built-in `JsonNamingPolicy.PascalCase` naming policy, and the strongly-typed generic `JsonSerializerOptions.GetTypeInfo` and `JsonSerializerOptions.TryGetTypeInfo` metadata accessors (generic overloads that return a typed `JsonTypeInfo`). USE ONLY when the user is targeting net11.0 or later and needs PascalCase JSON property or dictionary-key names without writing a custom naming policy, a strongly-typed generic `JsonTypeInfo` instead of the non-generic `JsonTypeInfo`, or a no-throw way to probe whether a type's serialization metadata is resolved. DO NOT USE when the target is earlier than net11.0, the requested behavior uses an established pre-net11 naming policy, or the user explicitly selected another JSON library.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[199,200,201,202,140,203,204,205,206,207,208,170,33,209,210,211,147,212,213,214,215,178,216,217,22],"system","json","text","system text json net11","policy","metadata","library","serialization","behavior","user","probe","guidance","later","type","dictionary","naming","targeting","custom","generic",{"skillNo":219,"name":220,"nameZh":6,"description":221,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":222,"categories":223,"keywords":226,"publishedAt":43},"01M6DZRRJP3S662NFSG1RSPQQ7","process-api-net11","Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText\u002FBytes\u002FLines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fprocess-api-net11\u002FSKILL.md",[224,225],{"categoryNo":98,"categoryName":99,"taxonomyType":100,"taxonomyTypeDesc":101},{"categoryNo":103,"categoryName":104,"taxonomyType":105,"taxonomyTypeDesc":106},[116,227,228,229,111,230,165,199,170,210,211,147,231,232,233,234,215,178,235],"process","process api net11","diagnostics","start","basic","processes","output","usage","new"]