Compiler Warning ASPIREDOTNETPROJECT001
このコンテンツはまだ日本語訳がありません。
AddDotnetProject types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
In Aspire 13.5, this diagnostic is reported when using the following experimental APIs from Aspire.Hosting.Dotnet:
AddDotnetProjectextension methodsDotnetProjectResourceWithBuildEnvironmentoverloads forDotnetProjectResource
These APIs add and configure a C# project or file-based C# app in the application model as an ExecutableResource that’s launched through the .NET SDK.
Example in Aspire 13.5
Section titled “Example in Aspire 13.5”In Aspire 13.5, the following code generates ASPIREDOTNETPROJECT001:
var builder = DistributedApplication.CreateBuilder(args);
builder.AddDotnetProject("inventoryservice", @"..\InventoryService.cs");
builder.Build().Run();To correct this warning
Section titled “To correct this warning”Upgrade to Aspire 13.6 or later. After upgrading, remove ASPIREDOTNETPROJECT001 suppressions from .editorconfig files, project NoWarn properties, and #pragma warning directives. Keep any required suppressions for other diagnostics, including ASPIREBLAZOR001.
For earlier versions, 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 = 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);ASPIREDOTNETPROJECT001</NoWarn></PropertyGroup> -
Suppress in code with the
#pragma warning disable ASPIREDOTNETPROJECT001directive:Suppressing the warning #pragma warning disable ASPIREDOTNETPROJECT001builder.AddDotnetProject("inventoryservice", @"..\InventoryService.cs");#pragma warning restore ASPIREDOTNETPROJECT001
See also
Section titled “See also”- ASPIRECSHARPAPPS001 - Related experimental C# app API
- ASPIREPROJECTS001 - Related experimental project launch defaults APIs