Visual Studio Toolbox: Accelerate your builds of SDK-style .NET projects
The Visual Studio Toolbox show helps you become a more productive developer by focusing on tooling in and out of Visual Studio. Our latest episode of VS Toolbox (available both on Learn and YouTube) features Drew Noakes from the .NET team. He demonstrates how you can dramatically reduce build times for SDK-style .NET projects.
What is build acceleration?
Build acceleration for .NET SDK style projects is an opt-in feature that directs Visual Studio to only build projects that had modifications while skipping projects that were unchanged. Enabling Build Acceleration can reduce incremental build times by up to 80% for SDK-style .NET projects.
To enable build acceleration in your solution, add or edit a top-level Directory.Build.props file to include the following:
<Project> <PropertyGroup> <AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio> </PropertyGroup> </Project>
How does build acceleration work?
Visual Studio uses MSBuild to build .NET projects. There is some overhead associated with calling MSBuild to build each project, so Visual Studio uses a “fast up-to-date check” (FUTDC) to avoid calling MSBuild unless needed. This FUTDC can quickly determine if anything has changed in the project that would cause a build to be required.
Sometimes, the FUTDC identifies that no compilation is required, yet identifies some files need to be copied to the output directory, either from the current project or from a referenced one. Historically in this scenario, the FUTDC would call MSBuild to build the project, even though no compilation was required. This was done to ensure that the files were copied to the output directory. With the build acceleration feature, Visual Studio will perform these files copies directly rather than calling MSBuild to do them.
Learn more about build acceleration on the VS Toolbox show!
Check out the Visual Studio Toolbox episode below to see Build Acceleration in action and go try out the new feature!