[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74EXDH6W66YVVK50AYKSK4F":3,"skill-same:01M74EXDH6W66YVVK50AYKSK4F":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":15,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":13,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M74EXDH6W66YVVK50AYKSK4F","directory-build-organization",null,"Organizes shared MSBuild policy across Directory.Build.props, Directory.Build.targets, Directory.Build.rsp, and Directory.Packages.props: centralizing repeated properties, targets, and package versions, hierarchy and import structure, props-versus-targets placement, and folder or project exceptions. Use when two or more projects repeat MSBuild policy, or an existing Directory.Build hierarchy has an import, placement, or layering defect, even if only one project is affected. Not for a one-project repo without a Directory.Build file, property value or condition semantics, legacy-to-SDK migration, or non-MSBuild systems.","Cratis\u002FArchitecture","Cratis","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F16456213?v=4","01M6BXRH290K4C8RS4PTKK3HXQ","01M74ET2PT8TQK44HAHJBABW28",0,"MIT","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: directory-build-organization\ndescription: 'Organizes shared MSBuild policy across Directory.Build.props, Directory.Build.targets, Directory.Build.rsp, and Directory.Packages.props: centralizing repeated properties, targets, and package versions, hierarchy and import structure, props-versus-targets placement, and folder or project exceptions. Use when two or more projects repeat MSBuild policy, or an existing Directory.Build hierarchy has an import, placement, or layering defect, even if only one project is affected. Not for a one-project repo without a Directory.Build file, property value or condition semantics, legacy-to-SDK migration, or non-MSBuild systems.'\nlicense: MIT\n---\n\u003C!-- cratis-ai-managed: skills\u002Fdirectory-build-organization\u002FSKILL.md -->\n\n\u003C!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, navigation and the changes listed in NOTICE. Upstream: https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills (plugins\u002Fdotnet-msbuild\u002Fskills\u002Fdirectory-build-organization\u002FSKILL.md; see NOTICE) -->\n\n# Organizing Build Infrastructure with Directory.Build Files\n\nCratis rules in `.cratis\u002Fai\u002Frules\u002F` (including `csharp.md`, `specs.csharp.md`, and `orleans.md`) and the `cratis-*` skills win where they differ.\n\n## Intent control\n\n- For \"should we\", \"how should we organize\", \"recommend\", \"advise\", or review\n  requests, inspect the actual project files and return a proposed layout only.\n  Do not create or edit files unless the user explicitly asks to apply, move,\n  centralize, or clean up the configuration.\n- Before summarizing, verify which project retains each project-specific\n  property, item, or target. Name the actual file; do not infer it from sibling\n  names.\n- Recommend a verification command only after discovering a real `.sln`,\n  `.slnx`, `.proj`, or project file at that path. If no repo-root entry point\n  exists, give commands for the discovered projects or state that the entry\n  point was not found.\n- Every advice response must explain that `Microsoft.Common.props` searches\n  upward from each project and automatically imports the nearest\n  `Directory.Build.props` early; project values can then override shared\n  defaults. Explain the equivalent late `Microsoft.Common.targets` import when\n  recommending `Directory.Build.targets`.\n\n## Directory.Build.props vs Directory.Build.targets\n\nUnderstanding which file to use is critical. They differ in **when** they are imported during evaluation:\n\n**Evaluation order:**\n\n```\nMicrosoft.Common.props imports Directory.Build.props early\n→ project body and package\u002Fproject imports evaluate\n→ Microsoft.Common.targets imports Directory.Build.targets late\n```\n\n| Use `.props` for | Use `.targets` for |\n|---|---|\n| Setting property defaults | Custom build targets |\n| Common item definitions | Late-bound property overrides |\n| Properties projects can override | Post-build steps |\n| Assembly\u002Fpackage metadata | Conditional logic on final values |\n| Analyzer PackageReferences | Targets that depend on SDK-defined properties |\n\n**Rule of thumb:** Properties and items go in `.props`. Custom targets and late-bound logic go in `.targets`.\n\nBecause `.props` is imported before the project file, the project can override any value set there. Because `.targets` is imported after everything, it gets the final say—but projects cannot override `.targets` values.\n\n### ⚠️ Critical: TargetFramework Availability in .props vs .targets\n\n**Property conditions on `$(TargetFramework)` in `.props` files silently fail for single-targeting projects** — the property is empty during `.props` evaluation. Move TFM-conditional properties to `.targets` instead. ItemGroup and Target conditions are not affected.\n\nSee [targetframework-props-pitfall.md](references\u002Ftargetframework-props-pitfall.md) for the full explanation.\n\n## Directory.Build.props\n\nGood candidates: language settings, assembly\u002Fpackage metadata, build warnings, code analysis, common analyzers.\n\n```xml\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CNullable>enable\u003C\u002FNullable>\n    \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n    \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n    \u003CEnforceCodeStyleInBuild>true\u003C\u002FEnforceCodeStyleInBuild>\n    \u003CCompany>Contoso\u003C\u002FCompany>\n    \u003CAuthors>Contoso Engineering\u003C\u002FAuthors>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\n**Do NOT put here:** project-specific TFMs, project-specific PackageReferences, targets\u002Fbuild logic, or properties depending on SDK-defined values (not available during `.props` evaluation).\n\n## Directory.Build.targets\n\nGood candidates: custom build targets, late-bound property overrides (values depending on SDK properties), post-build validation.\n\n```xml\n\u003CProject>\n  \u003CTarget Name=\"ValidateProjectSettings\" BeforeTargets=\"Build\">\n    \u003CError Text=\"All libraries must target netstandard2.0 or higher\"\n           Condition=\"'$(OutputType)' == 'Library' AND '$(TargetFramework)' == 'net472'\" \u002F>\n  \u003C\u002FTarget>\n\n  \u003CPropertyGroup>\n    \u003C!-- DocumentationFile depends on OutputPath, which is set by the SDK -->\n    \u003CDocumentationFile Condition=\"'$(IsPackable)' == 'true'\">$(OutputPath)$(AssemblyName).xml\u003C\u002FDocumentationFile>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\n## Directory.Packages.props (Central Package Management)\n\nCentral Package Management (CPM) provides a single source of truth for all NuGet package versions. 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**Enable CPM in `Directory.Packages.props` at the repo root:**\n\n```xml\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CManagePackageVersionsCentrally>true\u003C\u002FManagePackageVersionsCentrally>\n  \u003C\u002FPropertyGroup>\n\n  \u003CItemGroup>\n    \u003CPackageVersion Include=\"Microsoft.Extensions.Logging\" Version=\"8.0.0\" \u002F>\n    \u003CPackageVersion Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n    \u003CPackageVersion Include=\"xunit\" Version=\"2.9.0\" \u002F>\n    \u003CPackageVersion Include=\"xunit.runner.visualstudio\" Version=\"2.8.2\" \u002F>\n  \u003C\u002FItemGroup>\n\n  \u003CItemGroup>\n    \u003C!-- GlobalPackageReference applies to ALL projects — great for analyzers -->\n    \u003CGlobalPackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\" \u002F>\n    \u003CGlobalPackageReference Include=\"Microsoft.CodeAnalysis.NetAnalyzers\" Version=\"8.0.0\" \u002F>\n  \u003C\u002FItemGroup>\n\u003C\u002FProject>\n```\n\n## Directory.Build.rsp\n\nContains default MSBuild CLI arguments applied to all builds under the directory tree.\n\n**Example `Directory.Build.rsp`:**\n\n```\n\u002Fmaxcpucount\n\u002FnodeReuse:false\n\u002FconsoleLoggerParameters:Summary;ForceNoAlign\n\u002FwarnAsMessage:MSB3277\n```\n\n- Works with both `msbuild` and `dotnet` CLI in modern .NET versions\n- Great for enforcing consistent CI and local build flags\n- Each argument goes on its own line\n\n## Multi-level Directory.Build Files\n\nMSBuild only auto-imports the **first** `Directory.Build.props` (or `.targets`) it finds walking up from the project directory. To chain multiple levels, explicitly import the parent at the **top** of the inner file. See [multi-level-examples](references\u002Fmulti-level-examples.md) for full file examples.\n\n```xml\n\u003CProject>\n  \u003CImport Project=\"$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\u002F'))\"\n         Condition=\"Exists('$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\u002F'))')\" \u002F>\n\n  \u003C!-- Inner-level overrides go here -->\n\u003C\u002FProject>\n```\n\n**Example layout:**\n\n```\nrepo\u002F\n  Directory.Build.props          ← repo-wide (lang version, company info, analyzers)\n  Directory.Build.targets        ← repo-wide targets\n  Directory.Packages.props       ← central package versions\n  src\u002F\n    Directory.Build.props        ← src-specific (imports repo-level, sets IsPackable=true)\n  test\u002F\n    Directory.Build.props        ← test-specific (imports repo-level, sets IsPackable=false, adds test packages)\n```\n\n## Artifact Output Layout (.NET 8+)\n\nSet `\u003CArtifactsPath>$(MSBuildThisFileDirectory)artifacts\u003C\u002FArtifactsPath>` in `Directory.Build.props` to automatically produce project-name-separated `bin\u002F`, `obj\u002F`, and `publish\u002F` directories under a single `artifacts\u002F` folder, avoiding bin\u002Fobj clashes by default. See [common-patterns](references\u002Fcommon-patterns.md) for the directory layout and additional patterns (conditional settings by project type, post-pack validation).\n\n## Workflow: Organizing Build Infrastructure\n\n1. **Audit all `.csproj` files** — Catalog every `\u003CPropertyGroup>`, `\u003CItemGroup>`, and custom `\u003CTarget>` across the solution. Note which settings repeat and which are project-specific.\n2. **Create root `Directory.Build.props`** — Move shared property defaults (LangVersion, Nullable, TreatWarningsAsErrors, metadata) here. These are imported before the project file so projects can override them.\n3. **Create root `Directory.Build.targets`** — Move custom build targets, post-build validation, and any properties that depend on SDK-defined values (e.g., `OutputPath`, `TargetFramework` for single-targeting projects) here. These are imported after the SDK so all properties are available.\n4. **Create `Directory.Packages.props`** — Enable Central Package Management (`ManagePackageVersionsCentrally`), list all `PackageVersion` entries, and remove `Version=` from `PackageReference` items in `.csproj` files.\n5. **Set up multi-level hierarchy** — Create inner `Directory.Build.props` files for `src\u002F` and `test\u002F` folders with distinct settings. Use `GetPathOfFileAbove` to chain to the parent.\n6. **Simplify `.csproj` files** — Remove all centralized properties, version attributes, and duplicated targets. Each project should only contain what is unique to it.\n7. **Validate** — Run restore\u002Fbuild against the discovered `.sln`, `.slnx`,\n   `.proj`, or project path, for example\n   `dotnet restore \u003Centrypoint> && dotnet build \u003Centrypoint>`. If no root\n   entrypoint exists, validate each discovered project explicitly instead of\n   claiming a repo-root build. Use\n   `dotnet msbuild \u003Cproject> -pp:output.xml` to inspect the final merged view.\n\n## Troubleshooting\n\n| Problem | Cause | Fix |\n|---|---|---|\n| `Directory.Build.props` isn't picked up | File name casing wrong (exact match required on Linux\u002FmacOS) | Verify exact casing: `Directory.Build.props` (capital D, B) |\n| Properties from `.props` are ignored by projects | Project sets the same property after the import | Move the property to `Directory.Build.targets` to set it after the project |\n| Multi-level import doesn't work | Missing `GetPathOfFileAbove` import in inner file | Add the `\u003CImport>` element at the top of the inner file (see Multi-level section) |\n| Properties using SDK values are empty in `.props` | SDK properties aren't defined yet during `.props` evaluation | Move to `.targets` which is imported after the SDK |\n| `Directory.Packages.props` not found | File not at repo root or not named exactly | Must be named `Directory.Packages.props` and at or above the project directory |\n| Property condition on `$(TargetFramework)` doesn't match in `.props` | `TargetFramework` isn't set yet for single-targeting projects during `.props` evaluation | Move property to `.targets`, or use ItemGroup\u002FTarget conditions instead (which evaluate late) |\n\n**Diagnosis:** Use the preprocessed project output to see all imports and final property values:\n\n```bash\ndotnet msbuild -pp:output.xml MyProject.csproj\n```\n\nThis expands all imports inline so you can see exactly where each property is set and what the final evaluated value is.\n","\u003C!-- cratis-ai-managed: skills\u002Fdirectory-build-organization\u002FSKILL.md -->\n\n\u003C!-- Modified by Cratis from dotnet's original (MIT): frontmatter, applicability, navigation and the changes listed in NOTICE. Upstream: https:\u002F\u002Fgithub.com\u002Fdotnet\u002Fskills (plugins\u002Fdotnet-msbuild\u002Fskills\u002Fdirectory-build-organization\u002FSKILL.md; see NOTICE) -->\n\n# Organizing Build Infrastructure with Directory.Build Files\n\nCratis rules in `.cratis\u002Fai\u002Frules\u002F` (including `csharp.md`, `specs.csharp.md`, and `orleans.md`) and the `cratis-*` skills win where they differ.\n\n## Intent control\n\n- For \"should we\", \"how should we organize\", \"recommend\", \"advise\", or review\n  requests, inspect the actual project files and return a proposed layout only.\n  Do not create or edit files unless the user explicitly asks to apply, move,\n  centralize, or clean up the configuration.\n- Before summarizing, verify which project retains each project-specific\n  property, item, or target. Name the actual file; do not infer it from sibling\n  names.\n- Recommend a verification command only after discovering a real `.sln`,\n  `.slnx`, `.proj`, or project file at that path. If no repo-root entry point\n  exists, give commands for the discovered projects or state that the entry\n  point was not found.\n- Every advice response must explain that `Microsoft.Common.props` searches\n  upward from each project and automatically imports the nearest\n  `Directory.Build.props` early; project values can then override shared\n  defaults. Explain the equivalent late `Microsoft.Common.targets` import when\n  recommending `Directory.Build.targets`.\n\n## Directory.Build.props vs Directory.Build.targets\n\nUnderstanding which file to use is critical. They differ in **when** they are imported during evaluation:\n\n**Evaluation order:**\n\n```\nMicrosoft.Common.props imports Directory.Build.props early\n→ project body and package\u002Fproject imports evaluate\n→ Microsoft.Common.targets imports Directory.Build.targets late\n```\n\n| Use `.props` for | Use `.targets` for |\n|---|---|\n| Setting property defaults | Custom build targets |\n| Common item definitions | Late-bound property overrides |\n| Properties projects can override | Post-build steps |\n| Assembly\u002Fpackage metadata | Conditional logic on final values |\n| Analyzer PackageReferences | Targets that depend on SDK-defined properties |\n\n**Rule of thumb:** Properties and items go in `.props`. Custom targets and late-bound logic go in `.targets`.\n\nBecause `.props` is imported before the project file, the project can override any value set there. Because `.targets` is imported after everything, it gets the final say—but projects cannot override `.targets` values.\n\n### ⚠️ Critical: TargetFramework Availability in .props vs .targets\n\n**Property conditions on `$(TargetFramework)` in `.props` files silently fail for single-targeting projects** — the property is empty during `.props` evaluation. Move TFM-conditional properties to `.targets` instead. ItemGroup and Target conditions are not affected.\n\nSee [targetframework-props-pitfall.md](references\u002Ftargetframework-props-pitfall.md) for the full explanation.\n\n## Directory.Build.props\n\nGood candidates: language settings, assembly\u002Fpackage metadata, build warnings, code analysis, common analyzers.\n\n```xml\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CNullable>enable\u003C\u002FNullable>\n    \u003CImplicitUsings>enable\u003C\u002FImplicitUsings>\n    \u003CTreatWarningsAsErrors>true\u003C\u002FTreatWarningsAsErrors>\n    \u003CEnforceCodeStyleInBuild>true\u003C\u002FEnforceCodeStyleInBuild>\n    \u003CCompany>Contoso\u003C\u002FCompany>\n    \u003CAuthors>Contoso Engineering\u003C\u002FAuthors>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\n**Do NOT put here:** project-specific TFMs, project-specific PackageReferences, targets\u002Fbuild logic, or properties depending on SDK-defined values (not available during `.props` evaluation).\n\n## Directory.Build.targets\n\nGood candidates: custom build targets, late-bound property overrides (values depending on SDK properties), post-build validation.\n\n```xml\n\u003CProject>\n  \u003CTarget Name=\"ValidateProjectSettings\" BeforeTargets=\"Build\">\n    \u003CError Text=\"All libraries must target netstandard2.0 or higher\"\n           Condition=\"'$(OutputType)' == 'Library' AND '$(TargetFramework)' == 'net472'\" \u002F>\n  \u003C\u002FTarget>\n\n  \u003CPropertyGroup>\n    \u003C!-- DocumentationFile depends on OutputPath, which is set by the SDK -->\n    \u003CDocumentationFile Condition=\"'$(IsPackable)' == 'true'\">$(OutputPath)$(AssemblyName).xml\u003C\u002FDocumentationFile>\n  \u003C\u002FPropertyGroup>\n\u003C\u002FProject>\n```\n\n## Directory.Packages.props (Central Package Management)\n\nCentral Package Management (CPM) provides a single source of truth for all NuGet package versions. 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**Enable CPM in `Directory.Packages.props` at the repo root:**\n\n```xml\n\u003CProject>\n  \u003CPropertyGroup>\n    \u003CManagePackageVersionsCentrally>true\u003C\u002FManagePackageVersionsCentrally>\n  \u003C\u002FPropertyGroup>\n\n  \u003CItemGroup>\n    \u003CPackageVersion Include=\"Microsoft.Extensions.Logging\" Version=\"8.0.0\" \u002F>\n    \u003CPackageVersion Include=\"Newtonsoft.Json\" Version=\"13.0.3\" \u002F>\n    \u003CPackageVersion Include=\"xunit\" Version=\"2.9.0\" \u002F>\n    \u003CPackageVersion Include=\"xunit.runner.visualstudio\" Version=\"2.8.2\" \u002F>\n  \u003C\u002FItemGroup>\n\n  \u003CItemGroup>\n    \u003C!-- GlobalPackageReference applies to ALL projects — great for analyzers -->\n    \u003CGlobalPackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\" \u002F>\n    \u003CGlobalPackageReference Include=\"Microsoft.CodeAnalysis.NetAnalyzers\" Version=\"8.0.0\" \u002F>\n  \u003C\u002FItemGroup>\n\u003C\u002FProject>\n```\n\n## Directory.Build.rsp\n\nContains default MSBuild CLI arguments applied to all builds under the directory tree.\n\n**Example `Directory.Build.rsp`:**\n\n```\n\u002Fmaxcpucount\n\u002FnodeReuse:false\n\u002FconsoleLoggerParameters:Summary;ForceNoAlign\n\u002FwarnAsMessage:MSB3277\n```\n\n- Works with both `msbuild` and `dotnet` CLI in modern .NET versions\n- Great for enforcing consistent CI and local build flags\n- Each argument goes on its own line\n\n## Multi-level Directory.Build Files\n\nMSBuild only auto-imports the **first** `Directory.Build.props` (or `.targets`) it finds walking up from the project directory. To chain multiple levels, explicitly import the parent at the **top** of the inner file. See [multi-level-examples](references\u002Fmulti-level-examples.md) for full file examples.\n\n```xml\n\u003CProject>\n  \u003CImport Project=\"$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\u002F'))\"\n         Condition=\"Exists('$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)..\u002F'))')\" \u002F>\n\n  \u003C!-- Inner-level overrides go here -->\n\u003C\u002FProject>\n```\n\n**Example layout:**\n\n```\nrepo\u002F\n  Directory.Build.props          ← repo-wide (lang version, company info, analyzers)\n  Directory.Build.targets        ← repo-wide targets\n  Directory.Packages.props       ← central package versions\n  src\u002F\n    Directory.Build.props        ← src-specific (imports repo-level, sets IsPackable=true)\n  test\u002F\n    Directory.Build.props        ← test-specific (imports repo-level, sets IsPackable=false, adds test packages)\n```\n\n## Artifact Output Layout (.NET 8+)\n\nSet `\u003CArtifactsPath>$(MSBuildThisFileDirectory)artifacts\u003C\u002FArtifactsPath>` in `Directory.Build.props` to automatically produce project-name-separated `bin\u002F`, `obj\u002F`, and `publish\u002F` directories under a single `artifacts\u002F` folder, avoiding bin\u002Fobj clashes by default. See [common-patterns](references\u002Fcommon-patterns.md) for the directory layout and additional patterns (conditional settings by project type, post-pack validation).\n\n## Workflow: Organizing Build Infrastructure\n\n1. **Audit all `.csproj` files** — Catalog every `\u003CPropertyGroup>`, `\u003CItemGroup>`, and custom `\u003CTarget>` across the solution. Note which settings repeat and which are project-specific.\n2. **Create root `Directory.Build.props`** — Move shared property defaults (LangVersion, Nullable, TreatWarningsAsErrors, metadata) here. These are imported before the project file so projects can override them.\n3. **Create root `Directory.Build.targets`** — Move custom build targets, post-build validation, and any properties that depend on SDK-defined values (e.g., `OutputPath`, `TargetFramework` for single-targeting projects) here. These are imported after the SDK so all properties are available.\n4. **Create `Directory.Packages.props`** — Enable Central Package Management (`ManagePackageVersionsCentrally`), list all `PackageVersion` entries, and remove `Version=` from `PackageReference` items in `.csproj` files.\n5. **Set up multi-level hierarchy** — Create inner `Directory.Build.props` files for `src\u002F` and `test\u002F` folders with distinct settings. Use `GetPathOfFileAbove` to chain to the parent.\n6. **Simplify `.csproj` files** — Remove all centralized properties, version attributes, and duplicated targets. Each project should only contain what is unique to it.\n7. **Validate** — Run restore\u002Fbuild against the discovered `.sln`, `.slnx`,\n   `.proj`, or project path, for example\n   `dotnet restore \u003Centrypoint> && dotnet build \u003Centrypoint>`. If no root\n   entrypoint exists, validate each discovered project explicitly instead of\n   claiming a repo-root build. Use\n   `dotnet msbuild \u003Cproject> -pp:output.xml` to inspect the final merged view.\n\n## Troubleshooting\n\n| Problem | Cause | Fix |\n|---|---|---|\n| `Directory.Build.props` isn't picked up | File name casing wrong (exact match required on Linux\u002FmacOS) | Verify exact casing: `Directory.Build.props` (capital D, B) |\n| Properties from `.props` are ignored by projects | Project sets the same property after the import | Move the property to `Directory.Build.targets` to set it after the project |\n| Multi-level import doesn't work | Missing `GetPathOfFileAbove` import in inner file | Add the `\u003CImport>` element at the top of the inner file (see Multi-level section) |\n| Properties using SDK values are empty in `.props` | SDK properties aren't defined yet during `.props` evaluation | Move to `.targets` which is imported after the SDK |\n| `Directory.Packages.props` not found | File not at repo root or not named exactly | Must be named `Directory.Packages.props` and at or above the project directory |\n| Property condition on `$(TargetFramework)` doesn't match in `.props` | `TargetFramework` isn't set yet for single-targeting projects during `.props` evaluation | Move property to `.targets`, or use ItemGroup\u002FTarget conditions instead (which evaluate late) |\n\n**Diagnosis:** Use the preprocessed project output to see all imports and final property values:\n\n```bash\ndotnet msbuild -pp:output.xml MyProject.csproj\n```\n\nThis expands all imports inline so you can see exactly where each property is set and what the final evaluated value is.\n",{"name":5,"license":14,"description":7},"main","68f67ef8a166617b7a614aae2545f77d3c7d5ab8",".cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture","https:\u002F\u002Fwww.cratis.io\u002Farchitecture\u002F","https:\u002F\u002Fgithub.com\u002FCratis","https:\u002F\u002Fwww.cratis.io","Open-source (MIT) event sourcing and CQRS for .NET and beyond: Chronicle, Arc, Components and Screenplay.","2026-11-14 06:37:25",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Cratis\u002FArchitecture --skill directory-build-organization",{"tool":39,"command":40},"bunx","bunx skills add Cratis\u002FArchitecture --skill directory-build-organization",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Cratis\u002FArchitecture --skill directory-build-organization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002FSKILL.md",true,[47,51,57,63,67],{"path":48,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":15},"LICENSE","许可证",1181,{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"NOTICE","OTHER","其他",1083,"https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002FNOTICE",{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fcommon-patterns.md","REFERENCE","参考文档",1505,"https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002Freferences\u002Fcommon-patterns.md",{"path":64,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Fmulti-level-examples.md",4261,"https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002Freferences\u002Fmulti-level-examples.md",{"path":68,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Ftargetframework-props-pitfall.md",3535,"https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fdirectory-build-organization\u002Freferences\u002Ftargetframework-props-pitfall.md",[72,80,88,96,104,112],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M74EZHX4AJ09G25KF026Q7P5","vectorization","Designs, implements, optimizes, and reviews SIMD code in .NET: vectorizing scalar loops with TensorPrimitives, Vector64, Vector128, Vector256, Vector512, or hardware intrinsics, and reviewing existing SIMD code, including the generic Vector type, for contract equivalence, tail handling, memory safety, portability, fallbacks, and measured performance. Use when a .NET loop or SIMD routine is being written or reviewed. Not for performance work unrelated to SIMD.","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fvectorization\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M74EZD5Y0JQAJATM11TTSZRA","target-authoring","Canonical patterns for writing custom MSBuild targets: DependsOnTargets versus BeforeTargets and AfterTargets, the Build-to-CoreBuild three-level pattern, and the XxxDependsOn chain-extension pattern. Use when diagnosing or fixing custom-target anti-patterns: Directory.Build.targets redefining SDK targets, targets that replace CompileDependsOn instead of extending it, Outputs versus Returns misuse that returns stale results, missing Inputs\u002FOutputs causing needless rebuilds, or missing FileWrites registration. Not for incremental build tuning or general anti-pattern review (use the msbuild skill), or non-MSBuild build systems.","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Ftarget-authoring\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M74EZ8ZSW7M8ZR2WBDED4YNA","run-tests","Chooses and runs the repository-compatible .NET test command: classic, VSTest, bridged MTP, or native MTP syntax for MSTest, xUnit, NUnit, and TUnit. Use before running .NET tests or answering with a test command or flags: run the tests, one test, class, category, trait or target framework, combined filters, --filter-query, --no-build, --diag, TRX, coverage collection, crash or hang dumps, filter errors, or unrecognized options. Not for platform identification alone (use platform-detection), writing or debugging test code, interpreting a coverage report (use coverage-analysis), CI investigation, migration, or a persistent hot-reload loop.","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Frun-tests\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M74EZ4Q0W4B632KY77V6K5EP","profiling","Uses the free official .NET diagnostics CLI tools for profiling and runtime investigation in a repository: CPU, GC pressure, allocation growth, exception storms, lock contention, and slow code. Use when a .NET application needs performance or runtime profiling. Not for replacing realistic performance or load tests with ad-hoc tracing, production heap collection without a pause-risk plan, crash dumps (use dump-collect), or benchmark design (use microbenchmarking).","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fprofiling\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":108,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M74EZ08N8PGKKZY6Z1DRR5YS","platform-detection","Identifies a .NET project's test platform, framework, command mode, and SDK-style versus classic project system, resolving global.json, project, packages.config, Directory.Build.props, and Directory.Packages.props precedence for MSTest, xUnit, NUnit, and TUnit. Use when asking \"which test platform or framework?\", \"VSTest or MTP?\", or \"what runner does this project use?\", including bridge settings, UseVSTest opt-outs, and conflicting VSTest\u002FMTP configuration. Not for running or filtering tests, commands, flags, TRX, dumps, or test-command errors (use run-tests), or for hot-reload or migration requests.","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Fplatform-detection\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M74EYW35N2Y22QQXANX9TQ1V","orleans","Designs Microsoft Orleans systems from each primitive's purpose and failure model: grains, digital twins, state versus databases, transactions, messaging, streams, timers, reminders, Durable Jobs, stateless workers, grain services, startup, and hosting. Use when a task needs an Orleans design decision: inspect version and topology, choose the primitive, implement, and validate. Not for other actor stacks, batch processing, relational-only CRUD, or advice without an Orleans decision.","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FCratis\u002FArchitecture\u002Fblob\u002Fmain\u002F.cratis\u002Fai\u002Fskills\u002Forleans\u002FSKILL.md",[],[]]