Compiling and Building in Visual Studio
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here
You can use Visual Studio to build applications and to create assemblies and executable programs at frequent intervals during a development cycle. By building your code often, you can identify compile-time errors, such as incorrect syntax, misspelled keywords, and type mismatches, earlier. You can also detect and correct run-time errors, such as logic errors and semantic errors, by frequently building and running debug versions of the code.
When you have fully developed and sufficiently debugged a project or solution, you can compile its components in a Release build. By default, a Release build is optimized and designed to be smaller and run faster than a debug version. For more information, see Walkthrough: Building an Application.
Choosing a Build Method
You can build an application by using the default build options in the IDE, at a command prompt, or by using Team Foundation Build. Each of these options use MSBuild as the underlying technology, and each approach has specific benefits, as the following table shows.
|Build Method||Benefits||For more information|
|Using the IDE||- You can more easily create and run builds immediately.
- You can run multi-processor builds for C++ and C# projects.
- You can customize some aspects of the build system.
|Building and Cleaning Projects and Solutions in Visual Studio|
|Running an MSBuild command line||- You can build projects without installing Visual Studio.
- You can run multi-processor builds for all project types.
- You can customize most areas of the build system.
|Using Team Foundation Build||- You can automate your build process. For example, you can build one or more projects nightly or every time that code is checked in. You can also build projects on shared build servers rather than on your development computer.
- You can quickly specify the code that you want to build, the tests that you want to run, and other common options.
- You can modify the build workflow, and as needed, create build activities to perform deeply customized tasks.
|Build the application|
Building from the IDE
When you create a project, default build configurations are defined for it, and a solution build configuration is assigned to it to provide context for builds. Solution configurations define how the projects in solution are built and deployed. Project configurations are a set of project properties that are unique for a platform and build type (for example, Release Win32). You can edit these default configurations, and you can create your own configurations. For more information, see Introduction to the Project Designer and NIB How to: Modify Project Properties and Configuration Settings.
From within the IDE, you can perform the following additional tasks: