Skip to content

Commit d5bb07e

Browse files
gladjohnCopilot
andauthored
fix: make System.ValueTuple conditional on net462 only (#5894) (#5906)
* fix: make System.ValueTuple conditional on net462 only (#5894) System.ValueTuple was an unconditional PackageReference, causing it to appear in the NuGet dependency group for all TFMs including net472. On .NET Framework 4.7+ ValueTuple is in-box, so the NuGet package generates harmful binding redirects in Web.Config that cause runtime failures. Changes: - Microsoft.Identity.Client.csproj: restrict direct ValueTuple ref to net462 (the only TFM that needs it) and suppress the transitive dep from System.Formats.Asn1 on net472 via PrivateAssets/ExcludeAssets. - Remove unnecessary ValueTuple refs from Microsoft.Identity.Lab.Api and Microsoft.Identity.Test.Common (both netstandard2.0-only). Fixes #5894 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Microsoft.Identity.Client.csproj --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8dc9f18 commit d5bb07e

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,22 @@
154154

155155
<ItemGroup>
156156
<PackageReference Include="Microsoft.IdentityModel.Abstractions" />
157+
</ItemGroup>
158+
159+
<!-- System.ValueTuple is in-box starting with .NET Framework 4.7; only net462 needs the package. -->
160+
<ItemGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNetDesktop462)'">
157161
<PackageReference Include="System.ValueTuple" />
158162
</ItemGroup>
159163

164+
<!-- Suppress transitive System.ValueTuple from System.Formats.Asn1 on net472+, where it is in-box
165+
and the NuGet package causes harmful binding redirects (see #5894). -->
166+
<ItemGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNetDesktop472)'">
167+
<PackageReference Include="System.ValueTuple" PrivateAssets="All" ExcludeAssets="All" />
168+
</ItemGroup>
169+
160170
<ItemGroup Label="For public api analyzer support">
161171
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Shipped.txt" />
162172
<AdditionalFiles Include="PublicAPI/$(TargetFramework)/PublicAPI.Unshipped.txt" />
163173
</ItemGroup>
164174

165-
</Project>
175+
</Project>

src/client/Microsoft.Identity.Lab.Api/Microsoft.Identity.Lab.Api.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<PackageReference Include="System.Threading.Tasks" />
3838
<PackageReference Include="System.Threading.Tasks.Parallel" />
3939
<PackageReference Include="System.Threading.Thread" />
40-
<PackageReference Include="System.ValueTuple" />
4140
</ItemGroup>
4241

4342
<ItemGroup>

tests/Microsoft.Identity.Test.Common/Microsoft.Identity.Test.Common.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<PackageReference Include="System.Threading.Tasks" />
2121
<PackageReference Include="System.Threading.Tasks.Parallel" />
2222
<PackageReference Include="System.Threading.Thread" />
23-
<PackageReference Include="System.ValueTuple" />
2423
</ItemGroup>
2524

2625
<ItemGroup>

0 commit comments

Comments
 (0)