Skip to content

Commit 1560f03

Browse files
gavinbarronCopilot
andcommitted
fix: resolve CS0281 InternalsVisibleTo signing mismatch in Authentication tests
Replace #if DEBUG conditional in InternalsVisibleTo attributes with signing-aware logic that works for both signed and unsigned Release builds. - Authentication/AssemblyInfo.cs: use unconditional simple form since this assembly is never delay-signed at compile time - Authentication.Core/AssemblyInfo.cs: use #if SIGNED_BUILD conditional tied to actual SignAssembly MSBuild property - Authentication.Core.csproj: define SIGNED_BUILD constant when SignAssembly=true Fixes #3561 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 38a2c6f commit 1560f03

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/Authentication/Authentication.Core/Microsoft.Graph.Authentication.Core.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1313
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1414
</PropertyGroup>
15+
<PropertyGroup Condition="'$(SignAssembly)' == 'true'">
16+
<DefineConstants>$(DefineConstants);SIGNED_BUILD</DefineConstants>
17+
</PropertyGroup>
1518
<ItemGroup>
1619
<PackageReference Include="Azure.Identity" Version="1.18.0" />
1720
<PackageReference Include="Azure.Identity.Broker" Version="1.4.0" />
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Runtime.CompilerServices;
22

3-
#if DEBUG
4-
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test")]
5-
#else
3+
#if SIGNED_BUILD
64
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
5+
#else
6+
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test")]
77
#endif
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
using System.Runtime.CompilerServices;
22

3-
#if DEBUG
43
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test")]
5-
#else
6-
[assembly: InternalsVisibleTo("Microsoft.Graph.Authentication.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
7-
#endif

0 commit comments

Comments
 (0)