Compiler error ASPIREAZUREFUNCTIONS001
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Directory-based Azure Functions app APIs are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
This diagnostic is reported as an error by default when using the experimental directory-based Azure Functions app APIs in the Aspire.Hosting.Azure.Functions package. These APIs let you model a TypeScript or JavaScript Azure Functions app — one that has no .NET project file — as a resource in your AppHost. The following APIs are affected:
AddAzureFunctionsAppextension method onIDistributedApplicationBuilderWithHostStorageextension method onIResourceBuilder<AzureFunctionsAppResource>WithReferenceextension method onIResourceBuilder<AzureFunctionsAppResource>AzureFunctionsAppResourceclassAzureFunctionsLanguageenum
These APIs are pending API review and may change shape, or be removed, before becoming generally available (GA). The existing .NET project APIs, such as AddAzureFunctionsProject, are unaffected and do not require this suppression.
Example
Section titled “Example”The following code generates ASPIREAZUREFUNCTIONS001:
using Aspire.Hosting.Azure;
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();var blob = storage.AddBlobs("blob");
builder.AddAzureFunctionsApp("functions", "../functions", AzureFunctionsLanguage.TypeScript) .WithReference(blob);
builder.Build().Run();To correct this diagnostic
Section titled “To correct this diagnostic”Suppress the diagnostic with either of the following methods:
-
Add a
#pragma warning disabledirective in the source file where the API is used:AppHost.cs #pragma warning disable ASPIREAZUREFUNCTIONS001builder.AddAzureFunctionsApp("functions", "../functions", AzureFunctionsLanguage.TypeScript);#pragma warning restore ASPIREAZUREFUNCTIONS001 -
Add the following
PropertyGroupto your project file:C# project file <PropertyGroup><NoWarn>$(NoWarn);ASPIREAZUREFUNCTIONS001</NoWarn></PropertyGroup>
TypeScript and Go AppHosts This C# compiler diagnostic does not apply to addAzureFunctionsApp calls in TypeScript or AddAzureFunctionsApp calls in Go.
See also
Section titled “See also”- Azure Functions Hosting integration — Learn about the Azure Functions hosting integration, including the directory-based app support for TypeScript and JavaScript.