跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
其他技能

organizing-dotnet-solutions

Organize a .NET solution tree: decide which solution folder each project belongs to, name the folders, and write the .slnx that maps configurations and excludes projects from a build. USE FOR: creating or restructuring the solution folder tree, placing a new project, naming a solution folder, mapping solution configurations onto project configurations, and scoping a working set with a solution filter. DO NOT USE FOR: generating new projects from a template, or arranging the types, namespaces, and service registrations inside a single project.

Nice3point · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Nice3point/revit-skills --skill organizing-dotnet-solutions

技能说明


name: organizing-dotnet-solutions description: > Organize a .NET solution tree: decide which solution folder each project belongs to, name the folders, and write the .slnx that maps configurations and excludes projects from a build. USE FOR: creating or restructuring the solution folder tree, placing a new project, naming a solution folder, mapping solution configurations onto project configurations, and scoping a working set with a solution filter. DO NOT USE FOR: generating new projects from a template, or arranging the types, namespaces, and service registrations inside a single project. license: MIT

Organizing .NET Solutions

The solution tree shows what the repository produces and what each project contributes to it. Group projects by that contribution, never by the technology they are written in or the kind of file they contain.

When to use

  • Creating a solution tree, or restructuring one that has grown into a flat list.
  • Placing a new project, or deciding whether an existing folder should contain it.
  • Naming a solution folder, or judging whether a name still fits its contents.
  • Mapping solution configurations onto project configurations in .slnx.

Tiers

Every project belongs to exactly one tier, and the top level of the tree shows which.

  1. Deliverable — something a user installs or runs. One folder per deliverable.
  2. Shared — what deliverables consume. One folder per subject.
  3. Non-shipping — tests, build automation, samples, and local-development sandboxes. Their own top-level folders.

A project the user never receives is never placed in a deliverable's folder. A reader identifies the shipped deliverables from the top level alone.

Naming a folder

Name a folder for the thing it governs, then check that the name still describes the folder once every project inside it is listed.

  • Name a deliverable folder after the deliverable. A folder takes the name of the flagship project inside it: /Installer/ contains Contoso.Installer.
  • Name a shared folder after its subject. /Design System/ names a subject; /UI/ names nothing when every deliverable also has UI of its own.
  • Reject a name that admits more than one kind of member. Common, Core, Shared, and Misc accept anything and describe nothing.
  • Reject a name that describes the form of its members, such as Services or Libraries.
  • If a grouping needs an invented word to be named, the grouping is wrong.

The root of the tree

The root contains projects that need no qualifier: framework-level helpers and hosting defaults that belong to no product and no subject. Everything else is qualified by a product, a subject, or a role, and belongs in the folder that names that qualifier.

No folder name explains a project in the root. A root project's own name states what it is. Rename a root project whose name only makes sense from context.

In a single-product solution the core is the product, and the root contains it. In a multi-product solution a project serving one subject moves into that subject's folder.

Group by shared fate

A set of projects that is removed from the repository in one operation gets its own folder, whatever tier each project belongs to. Name the folder for what the set is, and delete the folder with the set.

Shared fate outranks the tier rule only while the set has an end. A set with no end remains in its tier.

  • A folder that contains one project after a planned change is removed with that change. Move its project up one level when the change is merged.
  • Skip the folder when the change is merged within days.

Depth

Depth equals rank. A top-level folder names something a maintainer would say when describing what the solution produces.

Add a subfolder only when its parent already contains more than roughly six projects and the subfolder names a real division. A subfolder containing one or two projects adds a level without adding a division.

Writing the .slnx

The .slnx format is XML, and the .NET SDK reads it directly.

<Solution>
  <Configurations>
    <BuildType Name="Debug" />
    <BuildType Name="Release" />
  </Configurations>
  <Folder Name="/Solution Items/">
    <File Path="Directory.Build.props" />
    <File Path="global.json" />
  </Folder>
  <Folder Name="/Design System/">
    <Project Path="source/Contoso.Controls/Contoso.Controls.csproj" />
  </Folder>
  <Folder Name="/Installer/">
    <Project Path="install/Contoso.Installer/Contoso.Installer.csproj" />
  </Folder>
  <Folder Name="/Playground/">
    <Project Path="playground/Contoso.Playground/Contoso.Playground.csproj" />
  </Folder>
  <Folder Name="/Playground/Emulators/">
    <Project Path="playground/Contoso.Playground.Storage/Contoso.Playground.Storage.csproj" />
  </Folder>
  <Folder Name="/Tests/">
    <Project Path="tests/Contoso.Tests.Unit/Contoso.Tests.Unit.csproj" />
  </Folder>
  <Project Path="source/Contoso.Extensions/Contoso.Extensions.csproj" />
</Solution>
  • A nested folder is a sibling element that specifies the full path, not a child element.
  • <File> puts the root files a maintainer edits into /Solution Items/.
  • Use forward slashes in every Path.
  • Sort entries within a folder.
  • Generate the file once it passes a few hundred lines.

Mapping configurations

A project builds in every solution configuration unless told otherwise. Map and exclude explicitly:

<Project Path="playground/Contoso.Playground/Contoso.Playground.csproj">
  <BuildType Solution="Release.Preview|*" Project="Release" />
  <Build Solution="Release.Preview|*" Project="false" />
</Project>
  • <BuildType Solution="…" Project="…" /> maps one solution configuration onto the project configuration to build.
  • <Build Project="false" /> excludes the project from every configuration; adding Solution="…" narrows the exclusion to one.

When a solution defines configurations beyond Debug and Release — one per target platform, f

阅读完整来源 ↗