İçeriğe geç
BelgelerAspire'ı deneyin
BelgelerDeneyin

Compiler Warning ASPIREDOTNETPROJECT001

Bu içerik henüz dilinizde mevcut değil.

Version introduced: 13.5

AddDotnetProject types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warning is reported when using experimental AddDotnetProject APIs from the Aspire.Hosting.Dotnet integration, including:

  • AddDotnetProject extension methods
  • DotnetProjectResource

These APIs add a C# project or file-based C# app to the application model as an ExecutableResource that’s launched through the .NET SDK.

The following code generates ASPIREDOTNETPROJECT001:

AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
builder.AddDotnetProject("inventoryservice", @"..\InventoryService.cs");
builder.Build().Run();

Suppress the warning with one of the following methods:

  • Set the severity of the rule in the .editorconfig file.

    .editorconfig
    [*.{cs,vb}]
    dotnet_diagnostic.ASPIREDOTNETPROJECT001.severity = none

    For more information about editor config files, see Configuration files for code analysis rules.

  • Add the following PropertyGroup to your project file:

    C# project file
    <PropertyGroup>
    <NoWarn>$(NoWarn);ASPIREDOTNETPROJECT001</NoWarn>
    </PropertyGroup>
  • Suppress in code with the #pragma warning disable ASPIREDOTNETPROJECT001 directive:

    Suppressing the warning
    #pragma warning disable ASPIREDOTNETPROJECT001
    builder.AddDotnetProject("inventoryservice", @"..\InventoryService.cs");
    #pragma warning restore ASPIREDOTNETPROJECT001