Building an ASP.NET project 2-10x slower with .NET 9 vs .NET 8 #43470
Description
Describe the bug
Building ASP.NET MVC applications with .NET 9 is 2x slower than .NET 8 for basic applications and 10x slower for applications that utilize several client-side libraries (e.g. with LibMan).
To Reproduce
See the following GitHub repository to reproduce: https://github.com/nwoolls/spl-dotnet-9-slow-build
The applications in this project were created with dotnet new mvc
. The projects in the simple
folder stop at that. The projects in the advanced
folder have a handful of client-side libraries that are installed using the LibMan CLI.
Running benchmark.js
from the repository yields:
Benchmark results:
Simple MVC .NET 8 (avg. seconds): 1.05
Simple MVC .NET 9 (avg. seconds): 2.08
Advanced MVC .NET 8 (avg. seconds): 3.48
Advanced MVC .NET 9 (avg. seconds): 30.96
Exceptions (if any)
Running dotnet clean
before dotnet build
results in dramatically faster build times, even though the client-side libraries are restored by LibMan prior to the BeforeBuild
MSBuild target.
Benchmark results:
Simple MVC .NET 8 (avg. seconds): 1.15
Simple MVC .NET 9 (avg. seconds): 2.06
Advanced MVC .NET 8 (avg. seconds): 2.21
Advanced MVC .NET 9 (avg. seconds): 2.42
Further technical details
- Include the output of
dotnet —info
dotnet --info
.NET SDK:
Version: 8.0.400
Commit: 36fe6dda56
Workload version: 8.0.400-manifests.27c4fe60
MSBuild version: 17.11.3+0c8610977
Runtime Environment:
OS Name: Mac OS X
OS Version: 14.6
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.400/
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 9.0.0-rc.1.24431.7
Architecture: arm64
Commit: static
.NET SDKs installed:
6.0.425 [/usr/local/share/dotnet/sdk]
8.0.400 [/usr/local/share/dotnet/sdk]
9.0.100-preview.7.24407.12 [/usr/local/share/dotnet/sdk]
9.0.100-rc.1.24452.12 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.33 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-preview.7.24406.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.1.24452.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-preview.7.24405.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.1.24431.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
/Users/nwoolls/src/dotnet/global.json
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
None