microsoft/aspire · error · InvalidOperationException

The ' ' assembly has no informational version.

Error message

The '{assembly.GetName().Name}' assembly has no informational version.

What it means

CreateGeneratorIdentity builds the generator identity from the assembly's AssemblyInformationalVersionAttribute. If the attribute is absent (assembly built without version metadata), it throws this InvalidOperationException, since a version is mandatory for the generator identity.

Solutions

  1. Build the project with the standard repo build (restore.sh + build.sh) so AssemblyInformationalVersionAttribute is generated.
  2. Ensure the csproj keeps <GenerateAssemblyInfo>true</GenerateAssemblyInfo> and defines a Version/InformationalVersion.
  3. Restore the official NuGet package instead of a locally stripped assembly.
  4. Check for MSBuild targets removing assembly attributes and remove/disable them.

Example fix

// before (csproj)
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

// after (csproj)
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>9.5.0</Version>
Defensive patterns

Strategy: validation

Validate before calling

var infoVersion = typeof(TypeScriptApiProjector).Assembly
    .GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
if (infoVersion is null) {
    throw new InvalidOperationException("Build the assembly with GenerateAssemblyInfo enabled");
}

Try / catch

try {
    var identity = CreateGeneratorIdentity();
} catch (InvalidOperationException ex) when (ex.Message.Contains("informational version")) {
    // fall back to a known version string or fail the build with a clear message
    throw;
}

Prevention

When it happens

Trigger: TypeScriptApiProjector initializing (resolving the generator identity) against an assembly compiled without an InformationalVersion, e.g. a stripped or locally hacked build lacking VersionInformational properties.

Common situations: Custom/local build script omitting generateAssemblyInfo or informational version; assembly metadata stripped by a post-build tooling step; referencing a malformed build of Aspire.Hosting.CodeGeneration.TypeScript.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/df3aa47a660fd13d. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.CodeGeneration.TypeScript/TypeScriptApiProjector.cs:951

                {
                    child = new ExportedValueTreeNode();
                    current.Children[segment] = child;
                }

                current = child;
            }

            current.Value = exportedValue;
        }

        return root;
    }

    private static TypeScriptApiGeneratorIdentity CreateGeneratorIdentity()
    {
        var assembly = typeof(TypeScriptApiProjector).Assembly;
        var version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
            ?? throw new InvalidOperationException(
                $"The '{assembly.GetName().Name}' assembly has no informational version.");

        return new TypeScriptApiGeneratorIdentity(assembly.GetName().Name!, version);
    }

    /// <summary>
    /// Projects one builder into an optional documented item plus the declaration fragments it
    /// contributes.
    /// </summary>
    /// <remarks>
    /// A package can extend a type another package owns. When that happens the type itself is not
    /// documented here — the owning package publishes it — but the members this package contributes
    /// still are. They are emitted as a separate interface augmentation fragment so TypeScript
    /// declaration merging reassembles the referenced stub and this package's contributed surface.
    /// </remarks>
    private (TypeScriptApiItem? Item, List<TypeScriptApiDeclaration> Declarations) ProjectBuilder(
        TypeScriptApiPackageIdentity package,
        BuilderModel builderModel,

View on GitHub (pinned to 25830f84bd)