Skip to content
Docs Try Aspire

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(...);
}