MSBuild

Last updated
MSBuild
Developer(s) Microsoft, .NET Foundation
Initial release2003;19 years ago (2003)
Stable release
v17.3.0 / 14 July 2022;3 months ago (2022-07-14) [1]
Repository
Written in C#
Operating system Cross-platform
Platform .NET Framework, .NET
Type Build tool
License MIT License
Website docs.microsoft.com/visualstudio/msbuild/msbuild   OOjs UI icon edit-ltr-progressive.svg

Microsoft Build Engine, or MSBuild, [2] [3] is a set of free and open-source build tools for managed code under the Common Language Infrastructure as well as native C and C++ code. It was first released in 2003 and was a part of .NET Framework. MSBuild is included with Visual Studio, but can also be run independently through MSBuild's command-line interface. [4]

Contents

Overview

MSBuild is a build tool that helps automate the process of creating a software product, including compiling the source code, packaging, testing, deployment and creating documentations. With MSBuild, it is possible to build Visual Studio projects and solutions without the Visual Studio IDE installed. MSBuild is free and open-source. [5] MSBuild was previously bundled with .NET Framework; starting with Visual Studio 2013, however, it is bundled with Visual Studio instead. [6] MSBuild is a functional replacement for the nmake utility, which remains in use in projects that originated in older Visual Studio releases.

MSBuild acts on MSBuild project files which have a similar XML syntax to Apache Ant or NAnt. Even though the syntax is based upon well-defined XML schema, the fundamental structure and operation is comparable to the traditional Unix make utility: the user specifies what will be used (typically source code files) and what the result should be (typically a static library, DLL or an executable application), but the utility itself decides what to do and the order in which to carry out the build.

MSBuild can build a project against a supported .NET Framework version of choice. This feature is called "multitargeting". Any given build of a project, however, can only target one version of the framework at a time. [7]

History

MSBuild was first created in 2003 targeting .NET Framework 2.0 for use in Visual Studio 2005 (codenamed Whidbey) [8] and Windows Vista (codenamed Longhorn). [9] [10]

Versions

Version.NET FrameworkVisual Studio VersionUsual Install Locations (x86) [11]
2.02.02005C:\Windows\Microsoft.NET\Framework\v2.0.50727
3.53.52008C:\Windows\Microsoft.NET\Framework\v3.5
4.7.3062.04.02010C:\Windows\Microsoft.NET\Framework\v4.0.30319
4.8.3761.04.5.22012C:\Windows\Microsoft.NET\Framework\v4.0.30319
12.0 [6] 4.5.22013C:\Program Files (x86)\MSBuild\12.0\Bin
14.04.62015C:\Program Files (x86)\MSBuild\14.0\Bin
15.0 [12] 4.72017
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
  • C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin
16.0 [13] 4.7.22019
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin
  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
17.02022
  • C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin
  • C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin
  • C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin

Terminology

Target
A Target contains a set of tasks for MSBuild to execute. The focus of MSBuild is the result Target specified when invoking MSBuild with the project file. This is because a Project may contain several Target entries, each executed sequentially (and conditionally). Subsequent dependent Targets are executed before the requested Target. The execution flow of the current Target can be directed using the following attributes: Condition, BeforeTargets, AfterTargets, & DependsOnTargets. Each Target may be self-contained with the necessary Tasks to complete itself. A Target is typically an action executed on a file, set of files or directory.
Task
A Task is a command which is executed in order to complete a Target. Tasks are used to group and execute any number of actions during the build process. They are typically implemented in a .NET assembly as a class which inherits from the Task class or implements the ITask interface. Many basic tasks are shipped as part of the .NET Framework, [14] and community developed tasks are freely available. Some examples of Tasks include copying files, creating directories, or parsing XML.
Properties and Items
MSBuild provides Properties and Items, which are conceptually equivalent to make's macros. Properties specify static values, whereas Items are usually used to define sets of files or folders on which to perform Tasks. Specifying files on Items is made easy by the support of wildcards.

See also

Related Research Articles

<span class="mw-page-title-main">Visual Basic .NET</span> Object-oriented computer programming language

Visual Basic, originally called Visual Basic .NET (VB.NET), is a multi-paradigm, object-oriented programming language, implemented on .NET, Mono, and the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language, the last version of which was Visual Basic 6.0. Although the ".NET" portion of the name was dropped in 2005, this article uses "Visual Basic [.NET]" to refer to all Visual Basic languages released since 2002, in order to distinguish between them and the classic Visual Basic. Along with C# and F#, it is one of the three main languages targeting the .NET ecosystem. As of March 11, 2020, Microsoft announced that evolution of the VB.NET language has concluded.

JScript is Microsoft's legacy dialect of the ECMAScript standard that is used in Microsoft's Internet Explorer 11 and older.

Extensible Application Markup Language is a declarative XML-based language that Microsoft developed for initializing structured values and objects. It is available under Microsoft's Open Specification Promise.

Windows Presentation Foundation (WPF) is a free and open-source graphical subsystem originally developed by Microsoft for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0 in 2006. WPF uses DirectX and attempts to provide a consistent programming model for building applications. It separates the user interface from business logic, and resembles similar XML-oriented object models, such as those implemented in XUL and SVG.

WinDbg is a multipurpose debugger for the Microsoft Windows computer operating system, distributed by Microsoft. Debugging is the process of finding and resolving errors in a system; in computing it also includes exploring the internal operation of software as a help to development. It can be used to debug user mode applications, device drivers, and the operating system itself in kernel mode.

Active Scripting is the technology used in Windows to implement component-based scripting support. It is based on OLE Automation and allows installation of additional scripting engines in the form of COM modules.

Sandcastle is a documentation generator from Microsoft. It automatically produces MSDN-style code documentation out of reflection information of .NET assemblies and XML documentation comments found in the source code of these assemblies. It can also be used to produce user documentation from Microsoft Assistance Markup Language (MAML) with the same look and feel as reference documentation.

Entity Framework (EF) is an open source object–relational mapping (ORM) framework for ADO.NET. It was originally shipped as an integral part of .NET Framework. Starting with Entity Framework version 6, it has been delivered separately from the .NET Framework.

Web Services Enhancements (WSE) is an obsolete add-on to the Microsoft .NET Framework, which includes a set of classes that implement additional WS-* web service specifications chiefly in areas such as security, reliable messaging, and sending attachments. Web services are business logic components which provide functionality via the Internet using standard protocols such as HTTP. Web services communicate via either SOAP or REST messages. WSE provides extensions to the SOAP protocol and allows the definition of custom security, reliable messaging, policy, etc. Developers can add these capabilities at design time using code or at deployment time through the use of a policy file.

Azure DevOps Server is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, testing and release management capabilities. It covers the entire application lifecycle, and enables DevOps capabilities. Azure DevOps can be used as a back-end to numerous integrated development environments (IDEs) but is tailored for Microsoft Visual Studio and Eclipse on all platforms.

<span class="mw-page-title-main">Visual Studio</span> Code editor and IDE

Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs, as well as websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code.

<span class="mw-page-title-main">PowerShell</span> Cross-platform command-line interface and scripting language for system and network administration

PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-source and cross-platform on 18 August 2016 with the introduction of PowerShell Core. The former is built on the .NET Framework, the latter on .NET Core.

Text Template Transformation Toolkit is a free and open-source template-based text generation framework. T4 source files are usually denoted by the file extension ".tt".

<span class="mw-page-title-main">.NET Framework</span> Software platform developed by Microsoft

The .NET Framework is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until being superseded by the cross-platform .NET project. It includes a large class library called Framework Class Library (FCL) and provides language interoperability across several programming languages. Programs written for .NET Framework execute in a software environment named the Common Language Runtime (CLR). The CLR is an application virtual machine that provides services such as security, memory management, and exception handling. As such, computer code written using .NET Framework is called "managed code". FCL and CLR together constitute the .NET Framework.

psake is a domain-specific language and build automation tool written in PowerShell to create builds using a dependency pattern similar to Rake or MSBuild. It intends to simplify the build language as compared to MSBuild scripting.

Razor is an ASP.NET programming syntax used to create dynamic web pages with the C# or VB.NET programming languages. Razor was in development in June 2010 and was released for Microsoft Visual Studio 2010 in January 2011. Razor is a simple-syntax view engine and was released as part of MVC 3 and the WebMatrix tool set.

Windows Runtime (WinRT) is a platform-agnostic component and application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. It is implemented in C++ and officially supports development in C++, Rust/WinRT, Python/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic .NET (VB.NET).

<span class="mw-page-title-main">Mono (software)</span> Computer software project

Mono is a free and open-source .NET Framework-compatible software framework. Originally by Ximian, it was later acquired by Novell, and is now being led by Xamarin, a subsidiary of Microsoft and the .NET Foundation. Mono can be run on many software systems.

<span class="mw-page-title-main">.NET</span> Free and open-source software platform developed by Microsoft

.NET is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is a cross-platform successor to .NET Framework. The project is primarily developed by Microsoft employees by way of the .NET Foundation, and released under the MIT License.

Microsoft Docs is the library of technical documentation for end users, developers, and IT professionals who work with Microsoft products. The Microsoft Docs website provides technical specifications, conceptual articles, tutorials, guides, API references, code samples and other information related to Microsoft software and web services. Microsoft Docs was introduced in 2016 as a replacement of MSDN and TechNet libraries which previously hosted some of these materials.

References

  1. "Latest release". Microsoft/msbuild. GitHub . Microsoft . Retrieved 2022-08-20.
  2. "microsoft/msbuild: The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio". GitHub . Microsoft . Retrieved 2019-07-23.
  3. Hashimi, Sayed Ibrahim; Bartholomew, William (2009). Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build. Microsoft Press. p. 406. ISBN   978-0-7356-2628-7.
  4. "MSBuild". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  5. Lander, Rich (18 March 2015). "MSBuild Engine is now Open Source on GitHub". .NET Blog. MSDN Blogs. Microsoft . Retrieved 2019-07-23.
  6. 1 2 "What's new in MSBuild 12.0". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  7. "MSBuild multitargeting overview". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  8. "Building, Testing, and Deployment". What's New in Visual Studio 2005. MSDN. Microsoft. Archived from the original on 2014-08-26.
  9. Sneath, Tim (July 19, 2004). "MSBuild: The New Build System for Visual Studio 2005 and Longhorn". Tim Sneath. MSDN Blogs. Retrieved 2018-04-22.
  10. England, Chuck (February 25, 2010). "Getting Started with MSBuild". The Visual Studio Blog. MSDN Blogs. Retrieved 2018-04-22.
  11. "Standard and custom Toolset configurations". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  12. "What's new in MSBuild 15". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  13. "What's new in MSBuild 16.0". MSBuild. Microsoft Docs . Retrieved 2019-07-23.
  14. "MSBuild task reference". MSBuild. Microsoft Docs . Retrieved 2019-07-23.

Further reading