Skip to content

PostSharp fails with custom TFM aliases (project.assets.json v4) #16

@gfraiteur

Description

@gfraiteur

Description

PostSharp fails to build projects that use custom TFM aliases (the "Multiple Equivalent Framework" feature introduced in .NET SDK 10.0.300+). The build errors with:

Unable to start PostSharp due to unsupported target framework: config-a

This is a follow-up to #15 (project.assets.json v4 support). While the v4 version check was fixed in v2026.0.9, PostSharp does not handle the TFM aliasing feature that v4 enables.

Root Cause

BuildClient.cs receives `` from MSBuild, which is the alias (e.g. config-a), not a standard TFM. `NuGetFramework.Parse("config-a")` returns `UnsupportedFramework`, and `BuildClient` rejects the build at line 710.

The v4 project.assets.json provides the alias-to-framework mapping in the project/frameworks section:

json "frameworks": { "config-a": { "framework": "net10.0", "targetAlias": "config-a" } }

PostSharp needs to resolve aliases to actual frameworks using either:

  • The project/frameworks section of the v4 assets file
  • Or `` (already available via _PostSharpTargetFrameworkMoniker)

Additionally, ProjectDepsBuilder uses FrameworkRidPair dictionary lookups against the assets file targets. In v4, target keys are aliases, so the lookup key must also use the alias (not the resolved framework) to match.

Reproduction

A Docker-based repro is on the topic/2026.0/GH16-tfm-alias branch of postsharp/PostSharp:

Tests/Core/DockerTests/Issue15-AssetsFileV4-Alias/

Run:
�ash docker build -t postsharp-test-v4-alias -f Tests/Core/DockerTests/Issue15-AssetsFileV4-Alias/Dockerfile Tests/Core/DockerTests/Issue15-AssetsFileV4-Alias docker run --rm postsharp-test-v4-alias

Exit code 2 = TFM alias not resolved (current behavior).

Environment

  • .NET SDK 10.0.300
  • PostSharp 2026.0.9
  • project.assets.json version 4
  • Custom TFM aliases (config-a, config-b both mapping to .NETCoreApp,Version=v10.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions