इसे छोड़कर कंटेंट पर जाएं
Docs Try Aspire
Docs Try

Compiler Error ASPIREEXPORT001

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

Version introduced: 13.2

Method '0' marked with [AspireExport] must be static.

This diagnostic error is reported when a method decorated with the [AspireExport] attribute is not declared as static. Methods exported to other language runtimes via the Aspire Type Specification (ATS) must be static because they are invoked by the ATS runtime without an object instance.

The following code generates ASPIREEXPORT001:

C# — Integration.cs
[AspireExport("addRedis")]
public IResourceBuilder<RedisResource> AddRedis(
IResourceBuilder<IResourceWithEnvironment> builder)
{
return builder.WithReference(...);
}

Add the static modifier to the method:

C# — Integration.cs
[AspireExport("addRedis")]
public static IResourceBuilder<RedisResource> AddRedis(
IResourceBuilder<IResourceWithEnvironment> builder)
{
return builder.WithReference(...);
}