Skip to content

Commit

Permalink
Avoid package dependencies on inbox libraries (#8669)
Browse files Browse the repository at this point in the history
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
Remove System.Net.Http package references which aren't needed as they underlying assembly is inbox on both .NETFramework and .NETCoreApp.
By avoiding the dependencies, we minimize the dependency graph and with that the attack surface.

cc @MichaelSimons (removes netstandard1.x dependencies)
  • Loading branch information
ViktorHofer authored Apr 19, 2023
1 parent 65a4041 commit 8326396
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 18 deletions.
1 change: 0 additions & 1 deletion documentation/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ This version of MSBuild shipped with Visual Studio 2022 version 17.0.0 and .NET
* Enable analyzers for the MSBuild repo with rules similar to `dotnet/runtime` (#5656). Thanks, @elachlan!
* Improved internal OptProf training scenarios (#6758).
* Delete Unreachable code (#6805). Thanks, @KirillOsenkov!
* Upgrade System.Net.Http package version used in tests (#6879).

#### Documentation

Expand Down
1 change: 0 additions & 1 deletion eng/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<PackageVersion Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageVersion Include="System.Memory" Version="$(SystemMemoryVersion)" />
<PackageVersion Include="System.Net.Http" Version="$(SystemNetHttpVersion)" />
<PackageVersion Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataLoadContextVersion)" />
<PackageVersion Include="System.Resources.Extensions" Version="$(SystemResourcesExtensionsPackageVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />

<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
<PackageDownload Include="NuGet.CommandLine" Version="[$(NuGetCommandLinePackageVersion)]" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" />
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="Microsoft.CodeAnalysis.Build.Tasks" />
<PackageReference Include="NuGet.Frameworks" >
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<PackageReference Include="System.Memory" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="System.Security.Principal.Windows" />
<PackageReference Include="System.Text.Encoding.CodePages" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<ItemGroup>
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Samples/ProjectCachePlugin/ProjectCachePlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Shouldly" Version="3.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/StringTools.UnitTests/StringTools.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

<ItemGroup>
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Tasks.UnitTests/Microsoft.Build.Tasks.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Security.Principal.Windows" />
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />

<ProjectReference Include="..\Build\Microsoft.Build.csproj" />
<ProjectReference Include="..\Framework\Microsoft.Build.Framework.csproj" />
<ProjectReference Include="..\MSBuild\MSBuild.csproj" />
Expand All @@ -30,6 +27,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.Security.Principal.Windows" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
Expand Down
10 changes: 5 additions & 5 deletions src/Tasks/Microsoft.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />

<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Resources.Extensions" />
</ItemGroup>
Expand All @@ -992,26 +991,27 @@
<PackageReference Include="Microsoft.Net.Compilers.Toolset" ExcludeAssets="all" Condition="'$(UsingToolMicrosoftNetCompilers)' == 'false'" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Threading.Tasks.Dataflow" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.Threading.Tasks.Dataflow" />

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

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<PackageReference Include="Microsoft.Win32.Registry" />
<PackageReference Include="System.Reflection.Metadata" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
<PackageReference Include="System.CodeDom" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="System.Security.Cryptography.Pkcs" />
<PackageReference Include="System.Security.Cryptography.Xml" />
<PackageReference Include="System.Security.Permissions" />
<PackageReference Include="System.Threading.Tasks.Dataflow" />

<Content Include="$(NuGetPackageRoot)microsoft.net.compilers.toolset\$(MicrosoftNetCompilersToolsetVersion)\tasks\net6.0\**\*" CopyToOutputDirectory="PreserveNewest" LinkBase="Roslyn" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<ItemGroup>
<PackageReference Include="Shouldly" />
<PackageReference Include="System.Net.Http" />
<PackageReference Include="Microsoft.CodeAnalysis.Build.Tasks" />

<ProjectReference Include="..\Utilities\Microsoft.Build.Utilities.csproj" />
Expand Down

0 comments on commit 8326396

Please sign in to comment.