Fix hosted agent samples Docker build failures due to experimental API warnings (#4641)

Add #pragma warning disable directives to suppress experimental API
diagnostics that cause build errors in Docker isolation (where repo-level
Directory.Build.props is not inherited):

- AgentWithHostedMCP: suppress MEAI001 (HostedMcpServerTool) and OPENAI001
  (GetResponsesClient)
- FoundrySingleAgent: suppress CA2252 (AIProjectClient preview features)
- FoundryMultiAgent: suppress CA2252 (AIProjectClient preview features)

Fixes #4365
This commit is contained in:
Roger Barreto
2026-03-13 10:13:59 +00:00
committed by GitHub
Unverified
parent a4b9539b62
commit 0009e330af
3 changed files with 7 additions and 0 deletions
@@ -4,6 +4,9 @@
// In this case the OpenAI responses service will invoke any MCP tools as required. MCP tools are not invoked by the Agent Framework.
// The sample demonstrates how to use MCP tools with auto approval by setting ApprovalMode to NeverRequire.
#pragma warning disable MEAI001 // HostedMcpServerTool, HostedMcpServerToolApprovalMode are experimental
#pragma warning disable OPENAI001 // GetResponsesClient is experimental
using Azure.AI.AgentServer.AgentFramework.Extensions;
using Azure.AI.OpenAI;
using Azure.Identity;
@@ -3,6 +3,8 @@
// This sample demonstrates a multi-agent workflow with Writer and Reviewer agents
// using Azure AI Foundry AIProjectClient and the Agent Framework WorkflowBuilder.
#pragma warning disable CA2252 // AIProjectClient and Agents API require opting into preview features
using Azure.AI.AgentServer.AgentFramework.Extensions;
using Azure.AI.Projects;
using Azure.Identity;
@@ -4,6 +4,8 @@
// Uses Microsoft Agent Framework with Azure AI Foundry.
// Ready for deployment to Foundry Hosted Agent service.
#pragma warning disable CA2252 // AIProjectClient and Agents API require opting into preview features
using System.ComponentModel;
using System.Globalization;
using System.Text;