A C# build that normally finishes within a few seconds suddenly started taking more than 20 minutes. Even cancelling the build can take around five minutes. Restarting the computer and switching back to older code did not help. What should I check to find out whether the problem is with the build configuration, development environment, or the system itself?
3 Answers
The build may be waiting on something external, such as package restoration, a network location, a service, or another process. Review the detailed build output and determine whether the delay happens during compilation, dependency restoration, file copying, or post-build commands. That should narrow down the cause much faster than repeatedly changing source code.
A full or failing disk, low available memory, or general disk problems can make both builds and cancellation take a very long time. Check free disk space and system resource usage while the build is running. Antivirus scanning, indexing, or a stuck background process could also be slowing file access.
There isn’t enough information to identify one specific cause yet. The IDE or build tool, project type, operating system, build output, and any recent changes would all matter. Check the build logs for the exact step where it pauses, and see whether CPU, memory, disk, or network usage spikes during the delay.

The IDE and build configuration are important here too. Comparing a normal build with a clean or command-line build can help show whether the problem is specific to the project, the IDE, or the machine.