-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Feature Request]: Can the transitive dependencies be reduced any? #9389
Comments
Compare to the Microsoft.Build.Tasks.Git package, which provides MSBuild tasks and does not depend on any NuGet packages -- it instead assumes that the process has already loaded the MSBuild DLLs. https://nuget.info/packages/Antlr4BuildTasks/12.4.0 shows
The System.Text.Encoding.CodePages assembly dependency seems a bit suspect; I'm not sure that's always available in the MSBuild process, and I don't think the NuGet dependencies of Antlr4BuildTasks matter for that purpose at all. |
Unfortunately, many of them do because build scripts are not reliably that simple. If you have any other specific ones to call out we can look at the nature of the dependency. |
In other words, Antlr4BuildTasks should
|
I agree with @KalleOlaviNiemitalo that the Antlr4BuildTasks package appears to be overselling its dependencies. You can work around this in your projects by minimizing the reference though, like - <PackageReference Include="Antlr4BuildTasks" Version="12.4.0" />
+ <PackageReference Include="Antlr4BuildTasks" Version="12.4.0" PrivateAssets="all" IncludeAssets="build" /> Where |
I think we provide all of those on all platforms (though bundling them would be basically harmless). |
@KalleOlaviNiemitalo mind copying your (excellent) analysis over into kaby76/Antlr4BuildTasks#69? |
It would depend on the version of MSBuild, right? If a project referencing Antlr4BuildTasks is built in Visual Studio 2017, then the appdomain might have some version of System.Text.Encoding.CodePages loaded, but surely not version 7.0.0.0. |
Good point, that's very true. |
Cool! Any idea when we can expect to see it in NuGet?
Thanks! That looks very helpful. I recall seeing something similar added to the csproj by Sam Harwell's old, outdated version of the ANTLR code generator, but I didn't know what it did. This updated version doesn't put that in automatically, though. |
It will release with .NET 8.0 and Visual Studio 17.8 soon. |
All right, and adding those attributes fixes the issue of dragging all those dependencies into all the downstream projects, so I'm good for now. |
Summary
The
Microsoft.Build.Utilities.Core
NuGet package is surprisingly heavyweight, dragging dozens of transitive NuGet dependencies into the project, including bizarre things likeSystem.Drawing.Common
and a whole host of security/permissions related things, none of which feel like they have anything to do with running a simple build script. Is there any way that this could be cut down a bit?Background and Motivation
I'm trying to use ANTLR in my project. The ANTLR code generator uses
Microsoft.Build.Utilities.Core
, which drags 30+ other packages along for the ride, significantly slowing down the CI build machine, because there are a lot of projects that depend on this project and so all of them get entire this transitive dependency set pulled in. Why in the world should I need all of that baggage just to build a parser?Proposed Feature
Would it be possible to examine the dependencies and see if there are any outdated references that can be trimmed? We all know how projects that have been around for a while tend to accumulate cruft, afterall...
Alternative Designs
No response
The text was updated successfully, but these errors were encountered: