NuGet/Home

[Bug]: Pack target is causing unnecessary project evaluations which noticeably slows down a project's build

Open

#11,530 创建于 2022年1月28日

在 GitHub 查看
 (9 评论) (0 反应) (0 负责人)HTML (292 fork)batch import
Functionality:PackPriority:3Product:dotnet.exeType:Bughelp wanted

仓库指标

Star
 (1,459 star)
PR 合并指标
 (平均合并 464天 23小时) (30 天内合并 1 个 PR)

描述

NuGet Product Used

dotnet.exe

Product Version

6.0.100

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

When building a .NET project which sets the GeneratePackOnBuild switch or when invoking the Pack target, NuGet calls into the underlying projects via an MSBuild Exec task (i.e. based on the project.assets.json data) and set BuildProjectReferences=false as a global property. Because of the global property, additional project evaluations are triggered which slow down the overall build.

This is especially noticeable when projects multi-target. As an example, let's consider a project "A" that multi-targets for net6.0;net5.0;netstandard2.0;net48. Based on the the described issue, the evaluations double from 5 to 10:

Before:

Outer build net6.0;net5.0;netstandard2.0;net48 Inner build net6.0 Inner build net5.0 Inner build netstandard2.0 Inner build net48

After:

Outer build net6.0;net5.0;netstandard2.0;net48 Inner build net6.0 Inner build net5.0 Inner build netstandard2.0 Inner build net48 Outer build net6.0;net5.0;netstandard2.0;net48 with additional BuildProjectReferences global property Inner build net6.0 with additional BuildProjectReferences global property Inner build net5.0 with additional BuildProjectReferences global property Inner build netstandard2.0 with additional BuildProjectReferences global property Inner build net48 with additional BuildProjectReferences global property

Shouldn't it be possible to avoid these extra evaluations by sequencing the gathering of the required data into the already running outer build, which runs without the BuildProjectReferences global property?

Verbose Logs

No response

贡献者指南