Share via


Configuring Targets and Tasks

You can configure MSBuild targets and tasks to run out-of-process with MSBuild so that you can target contexts that differ from the one you are running on. For example, you can target a 32-bit .NET Framework 2.0 application while the development computer is running on a 64-bit .NET Framework 4.5 operating system. You can also target computers that run with the .NET Framework 4 or earlier. The combination of 32- or 64-bitness and the specific .NET Framework version is known as the target context.

Installation

The .NET Framework 4.5 replaces the common language runtime (CLR), targets, tasks, and tools of the .NET Framework 4 without renaming them. Essentially, it creates a modified and improved .NET Framework 4.

To build a .NET Framework 4.5 application, you must also have the .NET Framework 4.5 reference assemblies. These are included in Visual Studio 2012.

Note

When the .NET Framework 4.5 is installed on a computer that has Visual Studio 2010, the modified framework enables Visual Studio 2010 to target all the target contexts that Visual Studio 2012 can target, except that it cannot target the .NET Framework 4.5.

Targets and Tasks

MSBuild runs certain build tasks out of process to target a larger set of contexts. For example, a 32-bit MSBuild might run a build task in a 64-bit process to target a 64-bit computer. This is controlled by UsingTask arguments and Task parameters. The targets installed by the .NET Framework 4.5 set these arguments and parameters, and no changes are required to build applications for the various target contexts.

If you want to create your own target context, you must set these arguments and parameters appropriately. Look in the .NET Framework 4.5 Microsoft.Common.targets file and the Microsoft.Common.Tasks file for examples. For information about how to create a custom task that can work with multiple target contexts, or how to modify existing tasks, see How to: Configure Targets and Tasks.

See Also

Other Resources

MSBuild Multitargeting Overview