Watch Aspire live streams문서Aspire 사용해 보기
Watch Aspire live streams문서사용해 보기

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:

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

Add the static modifier to the method:

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