Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio 22 slow Build time

we are working on a project with asp.net core 6 using Visual studio 22 and the build process stuck in

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\csc.exe

the build done successfuly ,but its slow . build time about 1 minute and 30 seconds. how to reduce build process time? Any help would be much appreciated.

like image 573
mohammed alani Avatar asked Sep 16 '25 22:09

mohammed alani


2 Answers

I am working on Blazor in vs2022 and every change requires recompilation or partial-compilation (hot reload) which was painfully slow.

The following changes I recommend for speeding up build times.

CPU

Get a processor with high turbo clock rate, around 4GHZ-5GHZ. If you are running a laptop, try get an Intel processor that ends with the H letter. For example, the latest Intel CPUs are 12700H/12900H. These are insanely fast laptop processors which can outperform many desktop CPUs.

Ensure your computer is using the Windows Performance profile or equivalent so that your CPU is not being throttled to save power.

DISK

First prize is a 4th GEN NVME drive paired with a computer that supports GEN4 NVME. Second prize is any NVME drive.

ENCRYPTION

First prize is not to use disk encryption, but if you do need it, opt for hardware encryption as software encryption will consume CPU resources leaving less for compiling. Hardware encryption uses the SSD's own internal encryption (which is always active) to handle the encryption.

My own testing has resulted in +- 40% loss in write performance with software encryption.

RAM

Just make sure you have enough RAM and Windows is not swapping memory to disk in order to compile your project. So most often 16GB RAM is sufficient, but I personally prefer to have 32GB so that more is cached by Windows in memory.

VS2022

Disable visual studio analyzers during build. Some have reported build times increase when this is turned off.

enter image description here

like image 163
TheLegendaryCopyCoder Avatar answered Sep 18 '25 16:09

TheLegendaryCopyCoder


I had this issue and turning off the analyzers during the build resolved it. Right click on the project and select properties. Then click Code Analysis, and uncheck the box. enter image description here

like image 45
Nick B Avatar answered Sep 18 '25 16:09

Nick B