Sdk: Slow incremental builds with .NET Core 2.0

Created on 4 Sep 2017  路  11Comments  路  Source: dotnet/sdk

Steps to reproduce

  1. Build a solution
  2. Build it again

Expected behavior

Building a project again should be fast if no files were changed. For example this happens in Visual Studio:

Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
1>------ Build started: Project: ScoreAnalyzer.Tests, Configuration: Debug Any CPU ------
1>ScoreAnalyzer.Tests -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.Tests\bin\Debug\netcoreapp2.0\ScoreAnalyzer.Tests.dll
========== Build: 1 succeeded, 0 failed, 8 up-to-date, 0 skipped ==========

Actual behavior

Rebuilding takes the same time as the first build.

C:\Users\Adam\Downloads\ScoreAnalyzer>dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  ScoreAnalyzer.DTOs -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.DTOs\bin\Debug\netstandard2.0\ScoreAnalyzer.DTOs.dll
  Helpers -> C:\Users\Adam\Downloads\ScoreAnalyzer\Helpers\bin\Debug\netstandard2.0\Helpers.dll
  Utilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\Utilities\bin\Debug\netstandard2.0\Utilities.dll
  ScoreAnalyzer.AWS -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.AWS\bin\Debug\netstandard2.0\ScoreAnalyzer.AWS.dll
  MusicRepresentations -> C:\Users\Adam\Downloads\ScoreAnalyzer\MusicRepresentations\bin\Debug\netstandard2.0\MusicRepresentations.dll
  ScoreAnalyzer.TestUtilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.TestUtilities\bin\Debug\netstandard2.0\ScoreAnalyzer.TestUtilities.dll
  Evaluation -> C:\Users\Adam\Downloads\ScoreAnalyzer\Evaluation\bin\Debug\netstandard2.0\Evaluation.dll
  ScoreAnalyzer -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer\bin\Debug\netstandard2.0\ScoreAnalyzer.dll
  ScoreAnalyzer.Tests -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.Tests\bin\Debug\netcoreapp2.0\ScoreAnalyzer.Tests.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:12.22

C:\Users\Adam\Downloads\ScoreAnalyzer>dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  ScoreAnalyzer.DTOs -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.DTOs\bin\Debug\netstandard2.0\ScoreAnalyzer.DTOs.dll
  Helpers -> C:\Users\Adam\Downloads\ScoreAnalyzer\Helpers\bin\Debug\netstandard2.0\Helpers.dll
  ScoreAnalyzer.AWS -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.AWS\bin\Debug\netstandard2.0\ScoreAnalyzer.AWS.dll
  Utilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\Utilities\bin\Debug\netstandard2.0\Utilities.dll
  MusicRepresentations -> C:\Users\Adam\Downloads\ScoreAnalyzer\MusicRepresentations\bin\Debug\netstandard2.0\MusicRepresentations.dll
  ScoreAnalyzer.TestUtilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.TestUtilities\bin\Debug\netstandard2.0\ScoreAnalyzer.TestUtilities.dll
  Evaluation -> C:\Users\Adam\Downloads\ScoreAnalyzer\Evaluation\bin\Debug\netstandard2.0\Evaluation.dll
  ScoreAnalyzer -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer\bin\Debug\netstandard2.0\ScoreAnalyzer.dll
  ScoreAnalyzer.Tests -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.Tests\bin\Debug\netcoreapp2.0\ScoreAnalyzer.Tests.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.57

C:\Users\Adam\Downloads\ScoreAnalyzer>dotnet build --no-restore
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  ScoreAnalyzer.DTOs -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.DTOs\bin\Debug\netstandard2.0\ScoreAnalyzer.DTOs.dll
  Helpers -> C:\Users\Adam\Downloads\ScoreAnalyzer\Helpers\bin\Debug\netstandard2.0\Helpers.dll
  ScoreAnalyzer.AWS -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.AWS\bin\Debug\netstandard2.0\ScoreAnalyzer.AWS.dll
  Utilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\Utilities\bin\Debug\netstandard2.0\Utilities.dll
  ScoreAnalyzer.TestUtilities -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.TestUtilities\bin\Debug\netstandard2.0\ScoreAnalyzer.TestUtilities.dll
  MusicRepresentations -> C:\Users\Adam\Downloads\ScoreAnalyzer\MusicRepresentations\bin\Debug\netstandard2.0\MusicRepresentations.dll
  Evaluation -> C:\Users\Adam\Downloads\ScoreAnalyzer\Evaluation\bin\Debug\netstandard2.0\Evaluation.dll
  ScoreAnalyzer -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer\bin\Debug\netstandard2.0\ScoreAnalyzer.dll
  ScoreAnalyzer.Tests -> C:\Users\Adam\Downloads\ScoreAnalyzer\ScoreAnalyzer.Tests\bin\Debug\netcoreapp2.0\ScoreAnalyzer.Tests.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:05.36

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
performance

Most helpful comment

@zuckerthoben Sorry to hear that. Can you open a new issue so that we can iterate on that with you? Please start by sharing the output of dotnet build /clp:PerformanceSummary.

All 11 comments

I'm having exactly the same issue and I have no idea where to start.

Our solution is very large, a verbose output grew to ~500k before I cancelled the build so I can't really debug it that way.

Has same problem in OS X.

same here on linux. Build time is still rather long (~6 to 10 seconds each time) even on the simplest hello world program.
This is especially annoying when doing continuous testing (dotnet watch test)

As I don't have experimented dotnet 1.xx, I can't compare and says this is worse or not.

Experiencing similar results here. Our project's build time went up to ~8min from ~2min after upgrade to 2.0. Package restore takes a whopping 5min.

@davkean which master issue from dotnet/project-system#2789 does this likely track back to?

@nguerrera close this when all the perf improvements make in, please.

We got our perf improvements in for 2.1.300 at this point with considerable perf improvements. Given that, I am going to close this issue.

While we've closed this issue, thought I'd update thread on the perf progress, we've more even more improvements in Preview 2 - https://blogs.msdn.microsoft.com/dotnet/2018/04/11/announcing-net-core-2-1-preview-2/:

image

Thank you for your work on improving build times!

However, in my team we still suffer from long incremental build times in a large web solution. Are there guides available to troubleshoot the build performance? We are on Core 2.1.X

@zuckerthoben Sorry to hear that. Can you open a new issue so that we can iterate on that with you? Please start by sharing the output of dotnet build /clp:PerformanceSummary.

Here are my build times for reference:

Command | 2.0.0 | 2.1.400
--- | --- | ---
dotnet build (after clean) | 12.22s | 2.56s
dotnet build (after build) | 5.57s | 1.17s
dotnet build --no-restore (after build) | 5.36s | 0.79s

Very nice improvement overall.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natemcmaster picture natemcmaster  路  3Comments

srayuws picture srayuws  路  3Comments

thomaslevesque picture thomaslevesque  路  3Comments

clairernovotny picture clairernovotny  路  3Comments

krwq picture krwq  路  3Comments