Skip to content

CS0281 InternalsVisibleTo mismatch in Authentication test builds #3561

Description

Description

Release CI builds that run without ESRP signing enabled fail with CS0281 errors when compiling the Authentication.Test project:

nFriend access was granted by 'Microsoft.Graph.Authentication, Version=2.36.1.0, Culture=neutral, PublicKeyToken=null', but the public key of the output assembly ('') does not match that specified by the InternalsVisibleTo attribute in the granting assembly. n

Root Cause

The InternalsVisibleTo attributes in both Authentication and Authentication.Core use #if DEBUG / #else to conditionally require a PublicKey in Release builds. This assumes Release always means signed, but some CI pipelines build in Release without -EnableSigning, causing a mismatch since neither assembly is strong-named.

Affected Files

  • src/Authentication/Authentication/Properties/AssemblyInfo.cs
  • src/Authentication/Authentication.Core/Properties/AssemblyInfo.cs

Proposed Fix

  • Authentication: Remove the conditional entirely — this assembly is never delay-signed at compile time (CSProjHelper.ps1 doesn't modify Authentication.csproj).
  • Authentication.Core: Replace #if DEBUG with #if SIGNED_BUILD and define SIGNED_BUILD in the .csproj when SignAssembly=true, so the condition tracks actual signing state.

Activity

  1. added 2 commits that reference this issue on Mar 24, 2026
    1560f03
    a305d11
  2. added a commit that references this issue on Mar 24, 2026
    019fb02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions