Click here to Skip to main content
15,846,078 members
Articles / BUILD

10 Tips to Improve Visual Studio Build Performance

Rate me:
Please Sign up or sign in to vote.
4.89/5 (12 votes)
24 Oct 2015CPOL8 min read 185.3K   15   8
Tips and tricks to speed up your VS.NET builds


With increasing business demands, ASP.NET projects become more and more complex and 'large' resulting in higher project build and load times. While buying a faster processor, better hardware and increasing RAM sizes are always options to consider to improve performance. Secondly, making architectural changes in ASP.NET project like separating project logically, minimizing number of assemblies and creating separate solutions can also be considered as long term strategies for the same. However these are not preferred approaches, if one wants to see the improvement instantly. To overcome such limitations, there are number of tips which can be used to quickly improve the application build times and thereby improving development productivity many folds.


Personally, I felt that when an application starts taking more than a minute to build, then it's time to sit down and think about making appropriate adjustments so that the application build time remains in acceptable limits. Broadly, the improvement factors can be categorized as below:

  1. Optimizing Visual Studio settings
  2. Overall Project architecture changes
  3. Use of improved hardware like processor, hard disk, RAM, etc.

For the purpose of this tip, we will mainly focus on #1, Optimizing Visual Studio settings, while touching briefly on #2, Project architectural changes.

Improvement Tips

I will start with making configuration changes in Visual Studio first and then will touch some project level settings followed by easy architectural changes and finally with some other options which are worth mentioning.

1. Use Parallel Builds

This is a magical setting which builds project in your solutions in parallel. Although, there could be project dependencies set in your project which will allow some project to build in particular order, still this setting would automatically deduce the parallelism among the projects during build. Set this value to an optimum level for your machine, e.g., for i7 processor which can execute up to 8 threads, you can set this setting to 8. This can be set in Visual Studio by Tools -> Options -> Projects and Solutions -> Build and Run. Refer below:

Image 1

2. Only Build Startup and Dependencies on Run

While being on the "Build and Run" settings mentioned in the previous step, check "Only build startup and dependencies on Run". This could be especially helpful when there are a large number of projects and you would like to build and run startup project only without building all the projects in solution even if they are not dependent and further those unrelated project could include pre or post build tasks. Refer Build the currently selected project.

Image 2

3. Set Build Verbosity

You can set the build verbosity based on your choice. However, updating this setting would also decrease the build overhead and reduces the build time. Again referring to the same screenshot provided in tip #1, set the MSBuild project build output verbosity to "Minimal". This will show minimum build detail during build in build output window. You can even set it to quiet if you need not see output or occasionally you may set it to detailed or even diagnostics to troubleshoot issues in build depending upon the requirement.

Image 3

4. PreCompiled MVC Razor Views

By default, MVC views are compiled at runtime. We can build MVC views during MVC project build, using MVCBuildViews as true. However, MVCBuildViews comes with performance penalty so pre-compiling MVC views is the most preferred approach to manage MVC view effectively. You can refer to Precompile your MVC Razor views using Razor Generator to try it yourself.

5. Build Required Projects Only

There could be certain projects in your solution such as setup projects or projects which are not directly required to execute your start up project and can be excluded from build. It would be a good idea to exclude them from build. To exclude a project; on the menu bar, choose Build, Configuration Manager. In the Project contexts table, locate the project you want to exclude from the build. In the Build column for the project, clear the check box. Refer to the screenshot below:

Image 4

6. Disable On-Access Virus scanner

This seems unrelated to Visual Studio build time, however on-access scanner scans file during file operations. Thus, it a good idea to investigate virus scanner and exclude development folders including .NET framework temporary files and folders.

7. Mystical Project Settings

There are some project settings which could also improve the build time of your Visual Studio project. It is not mandatory to use these properties as you may face inconsistency while setting these on your project; project may fail to build. However, these settings can have a huge impact on performance in the development system.

Set optimizeCompilations to true
<Compilation debug="true" targetFramework="4.5" optimizeCompilations="true"/>

This flag is used to optimize ASP.NET compilation behavior and it caters to development environment. The setting detects minor updates done during development like update in a single method, addition of new method, rename or deletion of APIs, etc. which do not require full recompile. Thus, only a specific portion of project is compiled. Refer to A new flag to optimize ASP.NET compilation behavior for more details.

Set MVCBuildViews to false

As the name suggest, this setting is used for building MVC views in MVC based ASP.NET project. If you are not using pre-compiled views, then it is important to note that during development MVCBuildview takes around 80% of application build time in MVC application. This setting must be set to true if any MVC view is updated, added so that updates are reflected after compilation.

However, in case there are no changes in views, this setting can be set to false, which drastically reduces the build time. As a workaround, you can set MVCBuildView false for Debug configuration and true for Release configuration. In case view debugging is required, then this setting can optionally be set to true manually for the time being.


To set its value, open your MVC project's csproj file in Text editor of your choice and manually edit the property in YourProjecct.csproj file.

Set Build Verbosity to Diagnostic

As per point #3, setting minimal build verbosity also has a impact on build. Setting Build output verbosity to diagnostic will let you know the details of individual operations being called during the build process. You can better a finer view and better control over minute activities during build and can fine tune based on your needs. Refer to the screen shot below to see a small snippet for the same.

Image 5

Build Solution from Command Line

On a side note, if you build your solution from command line, you may see improved build time than using Visual Studio IDE as it does not have fancy UI and you can use a variety of Command Line options:

ms build overvaluations /verbosity:diagnostic

8. Set Common Output Directory

This technique can also be handy in making sure that there are no duplicate assemblies and content created during build. It can provide significant improvement on build time as same content will not be copied to local project folders. Refer to the screenshot below to set output directory for your build output.

Image 6

An alternative technique, "Copy Local" to false can also be used to ensure that assemblies are not copied locally. However, this technique should be used diligently to ensure that it does not break the build itself. For more details, refer to Setting Copy Local to true.

Image 7

Note: It is also worth mentioning to use RAM disk as output folder instead of hard drive. However, I have not tried this setting though.

9. Remove Unused Files and Dead Code from your Projects

Let us explore some other aspects on our code structure which can be improved for better performance. Firstly, remove any unused files from your projects; classes which are not used, files which are included in project but never referenced. Unnecessary code acts as a technical debt and bring down performance of almost every application.

Removing dead code can also be used to make your code size smaller and manageable. It should also be practiced for the long run if not for instant performance optimization. There are many Static Code Analysis tools available across many platforms to achieve clean code. You can also use Visual Studio built-in code analysis tool to diagnose code related issues.

10. Keep Optimum Number of Projects and Assemblies

This is rather an architectural concern, however it fits well to improve build time. More the number of projects and assemblies, more time it takes Compiler to perform the compilation. There is no such exact number which can be considered good, however based on the complexity of project and business requirement, the number of project and assemblies can vary. Keeping this to optimum level results in quick application build time and run time performance even though it is time-consuming and painful process to change the project architecture and setup.


There can be many aspects to improve build time of a particular application and it depends on many factors. The performance improvement cannot be done overnight and should be an on-going process. I have not provided exact benchmarking results as results can vary greatly depend on your projects.

I hope this gives you some ideas to improve your project compilation time and I know that there could be many other improvement points left which could be part of this tip.

If you have any such tips and tricks, please share!

Related Readings


First version of tips to improve Visual Studio Build performance.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Technical Lead 3 Pillar Global
India India
Working as Technical lead in 3 Pillar Global. Having experience in ASP.NET, C#, Web API, WebServices, SQL Server and other Microsoft technologies.

Comments and Discussions

QuestionTracking active item Pin
jdukich25-Dec-21 10:40
jdukich25-Dec-21 10:40 
Question1m Build? Pin
BernardIE531720-Oct-21 21:26
BernardIE531720-Oct-21 21:26 
Question11. Adjust symbol caching Pin
grimmaceil21-Mar-17 6:50
grimmaceil21-Mar-17 6:50 
Question#4/6 doesn't make any sense Pin
Galatei29-Oct-15 23:01
Galatei29-Oct-15 23:01 
AnswerRe: #4/6 doesn't make any sense Pin
Kailash Shastri4-Nov-15 1:25
Kailash Shastri4-Nov-15 1:25 
AnswerRe: #4/6 doesn't make any sense Pin
Kailash Shastri7-Nov-15 4:15
Kailash Shastri7-Nov-15 4:15 
QuestionThank you.... Pin
Wombaticus25-Oct-15 2:12
Wombaticus25-Oct-15 2:12 
AnswerRe: Thank you.... Pin
Kailash Shastri25-Oct-15 18:22
Kailash Shastri25-Oct-15 18:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.