원클릭으로
fix-deai001
Fix DEAI001 build error: AddChatClients was removed
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Fix DEAI001 build error: AddChatClients was removed
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | fix-deai001 |
| description | Fix DEAI001 build error: AddChatClients was removed |
Devlooped.Extensions.AI provides configuration-driven, auto-reloading AI client registration for
Microsoft.Extensions.AI. Clients are resolved from appsettings.json (or any IConfiguration
source) using provider detection, and support hot-reload without restarting the application.
AddChatClients is removed (analyzer error DEAI001). In Visual Studio or Rider, use the
Migrate to AddAIClients code fix (light bulb) on the error for deterministic migration. When the
configure callback is too complex for the fixer (DEAI002), follow the manual steps below.
Replace every call site:
// IHostApplicationBuilder overload
builder.AddChatClients();
builder.AddChatClients(configure: (name, b) => b.UseLogging().UseOpenTelemetry());
builder.AddChatClients(prefix: "ai:clients", useDefaultProviders: true);
// IServiceCollection overload
services.AddChatClients(configuration);
services.AddChatClients(configuration, configure: (name, b) => b.UseLogging());
// IHostApplicationBuilder — simplest form
builder.AddAIClients();
// With custom prefix or provider control
builder.AddAIClients(prefix: "ai:clients", useDefaultProviders: true);
// IServiceCollection overload
services.AddAIClients(configuration);
services.AddAIClients(configuration, prefix: "ai:clients", useDefaultProviders: true);
The configure: (name, builder) => ... callback has no direct equivalent in AddAIClients.
NEVER remove it — always convert it to one or more ConfigureChatClientDefaults calls (see below).
Replaces the inline configure callback from the old AddChatClients. Separate from
AddAIClients so defaults can be declared independently and accumulated.
// Apply to every IChatClient registered via AddAIClients
builder.ConfigureChatClientDefaults(b => b
.UseLogging()
.UseOpenTelemetry());
// Speech clients
builder.ConfigureTextToSpeechClientDefaults(b => b.UseLogging());
builder.ConfigureSpeechToTextClientDefaults(b => b.UseLogging());
// IServiceCollection form
services.ConfigureChatClientDefaults(b => b.UseLogging());
The section path must use : as separator (not .), and is matched case-insensitively.
No parent-section inheritance — it matches the exact section path only.
// Only the client from "AI:Clients:Grok" gets this pipeline
builder.ConfigureChatClientDefaults("AI:Clients:Grok", b => b.UseRateLimiting());
// IServiceCollection form
services.ConfigureChatClientDefaults("AI:Clients:Grok", b => b.UseRateLimiting());
⚠️ The
configurelambda must NEVER be removed. Always convert it into the equivalentConfigureChatClientDefaultscall(s). Dropping the logic would silently change runtime behavior.
// Before
builder.AddChatClients(configure: (name, b) =>
{
b.UseLogging();
if (name == "AI:Clients:Grok")
b.UseRateLimiting();
});
// After
builder
.ConfigureChatClientDefaults(b => b.UseLogging())
.ConfigureChatClientDefaults("AI:Clients:Grok", b => b.UseRateLimiting())
.AddAIClients();
Multiple calls accumulate in registration order. Global and section-specific registrations can be freely mixed. Call order (global then section-specific then global again, etc.) is preserved.
var builder = new HostApplicationBuilder(args);
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
builder
.ConfigureChatClientDefaults(b => b // global: all chat clients
.UseLogging()
.UseOpenTelemetry())
.ConfigureChatClientDefaults("AI:Clients:Grok", b => b // section-specific
.UseRateLimiting())
.AddAIClients(); // register from configuration
var app = builder.Build();
var grok = app.Services.GetChatClient("AI:Clients:Grok");
var openai = app.Services.GetChatClient("AI:Clients:OpenAI");