Skip to content

Commit f1927df

Browse files
authored
Add System.Text.Json to Directory.Build.props to fix MSB3277 (#1669)
The Contracts project targets netstandard2.0 and pulls System.Text.Json 9.0.x from NuGet. Every other project targets net8.0, which ships with System.Text.Json 8.0.x in the framework. MSBuild sees both versions and warns (MSB3277). Adding an explicit System.Text.Json reference to Directory.Build.props means all net8.0 projects pick up the 9.0.x NuGet package instead of relying on the framework copy. One line, fixes the warning everywhere.
1 parent 6aad0b4 commit f1927df

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" PrivateAssets="all"/>
3333
<PackageReference Include="MinVer" PrivateAssets="all"/>
3434
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="all"/>
35+
<PackageReference Include="System.Text.Json" />
3536
</ItemGroup>
3637

3738
</Project>

src/Microsoft.ComponentDetection.Contracts/Microsoft.ComponentDetection.Contracts.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<PackageReference Include="packageurl-dotnet" />
1515
<PackageReference Include="System.Memory" />
1616
<PackageReference Include="System.Reactive" />
17-
<PackageReference Include="System.Text.Json" />
1817
<PackageReference Include="System.Threading.Tasks.Dataflow" />
1918
</ItemGroup>
2019

0 commit comments

Comments
 (0)