Skip to content

Commit 844fcc0

Browse files
Avoid package dependencies on inbox libraries (#8669) (#8714)
System.Security.Principal.Windows is inbox since net6.0 System.Net.Http is inbox since netcoreapp2.0 System.Reflection.Metadata is inbox since netcoreapp2.0 System.Threading.Tasks.Dataflow is inbox since netcoreapp2.0 Leave System.Net.Http package references which aren't needed as they underlying assembly is inbox on both .NETFramework and .NETCoreApp, to avoid component governance alerts about downloading (but not using) an old version. By avoiding the dependencies, we minimize the dependency graph and with that the attack surface. cc @MichaelSimons (removes netstandard1.x dependencies)
1 parent ab69595 commit 844fcc0

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/Build/Microsoft.Build.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<PackageReference Include="System.Memory" />
5050
</ItemGroup>
5151

52-
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
52+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
5353
<PackageReference Include="System.Reflection.Metadata" />
5454
<PackageReference Include="System.Security.Principal.Windows" />
5555
<PackageReference Include="System.Text.Encoding.CodePages" />

src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="System.Security.Principal.Windows" />
1918
<PackageReference Include="Shouldly" />
20-
<PackageReference Include="System.Net.Http" />
21-
2219
<ProjectReference Include="..\Build\Microsoft.Build.csproj" />
2320
<ProjectReference Include="..\Framework\Microsoft.Build.Framework.csproj" />
2421
<ProjectReference Include="..\MSBuild\MSBuild.csproj" />
@@ -30,6 +27,7 @@
3027
</ItemGroup>
3128

3229
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
30+
<PackageReference Include="System.Security.Principal.Windows" />
3331
<Reference Include="System" />
3432
<Reference Include="System.Core" />
3533
<Reference Include="System.IO.Compression" />

src/Tasks/Microsoft.Build.Tasks.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,6 @@
972972
</ItemGroup>
973973
<ItemGroup>
974974
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />
975-
976975
<PackageReference Include="System.Collections.Immutable" />
977976
<PackageReference Include="System.Resources.Extensions" />
978977
</ItemGroup>
@@ -992,26 +991,27 @@
992991
<PackageReference Include="Microsoft.Net.Compilers.Toolset" ExcludeAssets="all" Condition="'$(UsingToolMicrosoftNetCompilers)' == 'false'" />
993992
</ItemGroup>
994993

994+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
995+
<PackageReference Include="System.Threading.Tasks.Dataflow" />
996+
</ItemGroup>
997+
995998
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(DotNetBuildFromSource)' != 'true'">
996999
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" />
9971000
</ItemGroup>
9981001
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
999-
<PackageReference Include="System.Threading.Tasks.Dataflow" />
1000-
10011002
<Content Include="$(NuGetPackageRoot)microsoft.net.compilers.toolset\$(MicrosoftNetCompilersToolsetVersion)\tasks\net472\**\*" CopyToOutputDirectory="PreserveNewest" LinkBase="Roslyn" />
10021003
</ItemGroup>
10031004

10041005
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
10051006
<PackageReference Include="Microsoft.Win32.Registry" />
1007+
<PackageReference Include="System.Reflection.Metadata" />
10061008
</ItemGroup>
10071009

10081010
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
10091011
<PackageReference Include="System.CodeDom" />
1010-
<PackageReference Include="System.Reflection.Metadata" />
10111012
<PackageReference Include="System.Security.Cryptography.Pkcs" />
10121013
<PackageReference Include="System.Security.Cryptography.Xml" />
10131014
<PackageReference Include="System.Security.Permissions" />
1014-
<PackageReference Include="System.Threading.Tasks.Dataflow" />
10151015

10161016
<Content Include="$(NuGetPackageRoot)microsoft.net.compilers.toolset\$(MicrosoftNetCompilersToolsetVersion)\tasks\net6.0\**\*" CopyToOutputDirectory="PreserveNewest" LinkBase="Roslyn" />
10171017
</ItemGroup>

0 commit comments

Comments
 (0)