ワンクリックで
dotnet-shared-library-extraction
Extract shared code from a .NET Exe project into a class library for multi-project reuse
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Extract shared code from a .NET Exe project into a class library for multi-project reuse
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
How to implement async credential prompting with proper error handling across multiple implementations (console, MCP elicitation, etc.)
How to safely use MCP Elicitation (ElicitAsync) in .NET MCP servers
| name | dotnet-shared-library-extraction |
| description | Extract shared code from a .NET Exe project into a class library for multi-project reuse |
| domain | architecture |
| confidence | high |
| source | earned: FinaryExport MCP architecture proposal |
When a .NET solution needs to share code between multiple executable projects (CLI, MCP server, web API), extract the shared code into a class library. This avoids referencing an Exe project (which drags in all its dependencies) and creates a clean dependency graph.
Keep the original RootNamespace on the new library. If the original project was FinaryExport with namespace FinaryExport, set <RootNamespace>FinaryExport</RootNamespace> on the new .Core library. This means zero using statement changes across the entire codebase — files physically move, namespaces don't.
Split ServiceCollectionExtensions. The original AddFinaryExport() becomes AddFinaryCore() in Core (registers only shared services). Each consuming project registers its own specializations (e.g., ICredentialPrompt implementation).
Interface stays in Core, implementations split by consumer. ICredentialPrompt in Core. ConsoleCredentialPrompt in CLI. EnvCredentialPrompt in MCP. Each host decides how credentials are collected.
Packages follow the code. If CurlImpersonate is used by Core code, the PackageReference goes on Core. Consuming projects get it transitively. Don't duplicate PackageReferences.
Validate with existing tests first. After extraction, the CLI project must build clean and all tests must pass before writing any new code. This is a refactoring gate.
Before: FinaryExport (Exe) → has everything
After: FinaryExport.Core (Library) → auth, api, models, infrastructure
FinaryExport (Exe) → CLI, export, console prompts → references Core
FinaryExport.Mcp (Exe) → MCP server, tools, env prompts → references Core
ConsoleCredentialPrompt has no business in a library that MCP references).