From 35b531d66c7d63862d9b73477b04e29e403f75ee Mon Sep 17 00:00:00 2001 From: Tom Meschter Date: Mon, 13 Nov 2023 09:26:03 -0800 Subject: [PATCH] Specify PrivateAssets="all" The Microsoft.Net.Compilers.Toolset package does not contain libraries to reference; rather, it allows us to pick up different versions of the C# compiler and associated MSBuild files than what we would normally get from the SDK. As a NuGet package, however, it is subject to the same transitive reference rules as every other package and that means that consumers of our Microsoft.VisualStudio.ProjectSystem.Managed NuGet package _also_ end up depending on Microsoft.Net.Compilers.Toolset whether or not they want to. This means we're changing how consuming projects build in a way that has nothing to do with the functionality they need from Microsoft.VisualStudio.ProjectSystem.Managed which is not what was intended. We see this in other repos using Microsoft.Net.Compilers.Toolset; NuGet complains if they are not using the same version of the package. Here we fix this by specify that all the assets of the package are private, meaning that they will be used by projects that reference Microsoft.Net.Compilers.Toolset but will not be passed on transitively. We already do this with other packages that are used strictly to modify the build. --- eng/imports/HostAgnostic.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/imports/HostAgnostic.props b/eng/imports/HostAgnostic.props index e63137a6473..0c3a0e7de60 100644 --- a/eng/imports/HostAgnostic.props +++ b/eng/imports/HostAgnostic.props @@ -12,7 +12,7 @@ - +