콘텐츠로 이동
Docs Try Aspire
Docs Try

Compiler Error ASPIREEXPORT002

이 콘텐츠는 아직 번역되지 않았습니다.

Version introduced: 13.2

Export ID '0' is not a valid method name. Use a valid identifier (e.g., ‘addRedis’, ‘withEnvironment’).

This diagnostic error is reported when the export ID specified in an [AspireExport] attribute is not a valid identifier. Export IDs are used as method names in generated TypeScript (or other language) code, so they must follow the naming rules for those languages. Specifically, the ID must match the pattern [a-zA-Z][a-zA-Z0-9.]*.

The following code generates ASPIREEXPORT002:

C# — Integration.cs
[AspireExport("add-redis")] // Hyphens are not allowed
public static IResourceBuilder<RedisResource> AddRedis(
IResourceBuilder<IResourceWithEnvironment> builder)
{
return builder.WithReference(...);
}

Use a valid camelCase or dot-separated identifier as the export ID:

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