Compiler Warning ASPIREPOSTGRES001
Version introduced: 9.3
C# — AppHost.cs
The PostgreSQL MCP integration APIs are experimental and subject to change or removal in future updates. Suppress this diagnostic to proceed.
The WithPostgresMcp extension method for adding Model Context Protocol (MCP) support to PostgreSQL resources is an experimental feature. This API may change or be removed in future versions.
Example
Section titled “Example”The following code generates ASPIREPOSTGRES001:
var builder = DistributedApplication.CreateBuilder(args);
var db = builder.AddAzurePostgresFlexibleServer("postgres") .AddDatabase("mydb") .WithPostgresMcp();To correct this warning
Section titled “To correct this warning”Suppress the warning with either of the following methods:
-
Set the severity of the rule in the .editorconfig file.
.editorconfig [*.{cs,vb}]dotnet_diagnostic.ASPIREPOSTGRES001.severity = noneFor more information about editor config files, see Configuration files for code analysis rules.
-
Add the following
PropertyGroupto your project file:C# project file <PropertyGroup><NoWarn>$(NoWarn);ASPIREPOSTGRES001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disable ASPIREPOSTGRES001directive:C# — Suppressing the warning #pragma warning disable ASPIREPOSTGRES001var db = builder.AddAzurePostgresFlexibleServer("postgres").AddDatabase("mydb").WithPostgresMcp();#pragma warning restore ASPIREPOSTGRES001
See also
Section titled “See also”- PostgreSQL integration - Learn about PostgreSQL hosting integration
- Configure MCP - Learn about Model Context Protocol configuration