Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make private runtime-only dependencies on .NET Standard 2.0. #11109

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@

<PackageReference Include="Microsoft.IO.Redist" Condition="'$(FeatureMSIORedist)' == 'true'" />

<PackageReference Include="Microsoft.CodeAnalysis.Collections" PrivateAssets="all" />
<PackageReference Include="Microsoft.BuildXL.Processes" Condition="'$(FeatureReportFileAccesses)' == 'true'" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(DotNetBuildSourceOnly)' != 'true'">
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" PrivateAssets="all" />
</ItemGroup>
Expand Down
9 changes: 3 additions & 6 deletions src/Framework/Microsoft.Build.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@
<EnablePackageValidation>true</EnablePackageValidation>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Collections" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.Collections.Immutable" />
<!-- Promote CompilerServices.Unsafe from the old version we get from System.Memory on net472. -->
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" PrivateAssets="all" />
<Reference Include="System.Xaml" />
</ItemGroup>

<!-- When targeting NS2.0, make private all references not exposed in the public API. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<!-- Need Win32 API on .NET Standard to ping registry for some methods in ToolLocationHelper -->
<PackageReference Include="Microsoft.Win32.Registry" />
<PackageReference Include="System.Collections.Immutable" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 13 additions & 5 deletions src/Tasks/Microsoft.Build.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,6 @@
<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.Security.Cryptography.Pkcs" />
Expand All @@ -707,6 +702,19 @@
<Content Include="$(NuGetPackageRoot)microsoft.net.compilers.toolset\$(MicrosoftNetCompilersToolsetVersion)\tasks\netcore\**\*" CopyToOutputDirectory="PreserveNewest" LinkBase="Roslyn" />
</ItemGroup>

<!-- When targeting NS2.0, make private all references not exposed in the public API. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<ProjectReference Update="..\StringTools\StringTools.csproj" PrivateAssets="all" />
<PackageReference Update="System.CodeDom" PrivateAssets="all" />
<PackageReference Update="System.Collections.Immutable" PrivateAssets="all" />
<PackageReference Update="System.Resources.Extensions" PrivateAssets="all" />
<PackageReference Update="System.Security.Cryptography.Pkcs" PrivateAssets="all" />
<PackageReference Update="System.Security.Cryptography.Xml" PrivateAssets="all" />
<PackageReference Update="System.Threading.Tasks.Dataflow" PrivateAssets="all" />
<PackageReference Include="Microsoft.Win32.Registry" PrivateAssets="all" />
<PackageReference Include="System.Reflection.Metadata" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<!--
Content items in this project are used to copy files to the output directory but we don't
Expand Down
7 changes: 6 additions & 1 deletion src/Utilities/Microsoft.Build.Utilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" PrivateAssets="all" />
</ItemGroup>

<!-- When targeting NS2.0, make private all references not exposed in the public API. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<PackageReference Include="System.Text.Encoding.CodePages" />
<ProjectReference Update="..\StringTools\StringTools.csproj" PrivateAssets="all" />
<PackageReference Update="Microsoft.IO.Redist" PrivateAssets="all" />
<PackageReference Update="System.Collections.Immutable" PrivateAssets="all" />
<PackageReference Update="System.Configuration.ConfigurationManager" PrivateAssets="all" />
<PackageReference Include="Microsoft.Win32.Registry" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Label="Shared Code">
Expand Down
Loading