MSBuild
{{Short description|Build automation software}}
{{Redirect|Microsoft build|the conference|BUILD (Microsoft)}}
{{Infobox software
| name = MSBuild
| logo = MSBuild logo (2024).svg
| logo size = 64px
| developer = Microsoft, .NET Foundation
| released = {{Start date and age|2003|df=dmy}}
| discontinued =
| latest release version = v17.8.3
| latest release date = {{Start date and age|2023|11|15|df=dmy}}{{cite web |title=Latest release |department=Microsoft/msbuild |url=https://github.com/Microsoft/msbuild/releases/latest |website=GitHub |publisher=Microsoft |access-date=2022-08-20}}
| programming language = C#
| operating system = Cross-platform
| platform = .NET Framework, .NET
| size =
| language =
| language count =
| language footnote =
| genre = Build tool
| license = MIT License
}}
Microsoft Build Engine, or MSBuild,{{cite web |title=microsoft/msbuild: The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio |url=https://github.com/Microsoft/msbuild |website=GitHub |publisher=Microsoft |access-date=2019-07-23}}{{cite book |title=Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build |year=2009 |publisher=Microsoft Press |isbn=978-0-7356-2628-7 |first1=Sayed Ibrahim| last1=Hashimi |first2=William |last2=Bartholomew |pages=406}} 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.{{cite web |title=MSBuild |url=https://docs.microsoft.com/visualstudio/msbuild/msbuild |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}}
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.{{Cite web |last1=Lander |first1=Rich |date=2015-03-18 |df=dmy |title=MSBuild Engine is now Open Source on GitHub |url=https://devblogs.microsoft.com/dotnet/msbuild-engine-is-now-open-source-on-github/ |department=.NET Blog |website=MSDN Blogs |publisher=Microsoft |access-date=2019-07-23}} MSBuild was previously bundled with .NET Framework; starting with Visual Studio 2013, however, it is bundled with Visual Studio instead. 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.{{cite web |title=MSBuild multitargeting overview |url=https://docs.microsoft.com/visualstudio/msbuild/msbuild-multitargeting-overview |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}}
History
MSBuild was first created in 2003 targeting .NET Framework 2.0 for use in Visual Studio 2005 (codenamed Whidbey){{cite web |title=Building, Testing, and Deployment |department=What's New in Visual Studio 2005 |website=MSDN |publisher=Microsoft |url=http://msdn.microsoft.com/en-us/library/88fx1xy0(VS.80).aspx#rtmbuildtestdeploy |archive-url=https://web.archive.org/web/20140826051347/http://msdn.microsoft.com/en-us/library/88fx1xy0(VS.80).aspx#rtmbuildtestdeploy |archive-date=2014-08-26}} and Windows Vista (codenamed Longhorn).{{cite web |last1=Sneath |first1=Tim |date=2004-07-19 |title=MSBuild: The New Build System for Visual Studio 2005 and Longhorn |department=Tim Sneath |website=MSDN Blogs |url=https://blogs.msdn.microsoft.com/tims/2004/07/19/msbuild-the-new-build-system-for-visual-studio-2005-and-longhorn/ |df=mdy |access-date=2018-04-22}}{{cite web |last1=England |first1=Chuck |date=2010-02-25 |title=Getting Started with MSBuild |department=The Visual Studio Blog |website=MSDN Blogs |url=https://blogs.msdn.microsoft.com/visualstudio/2010/02/25/getting-started-with-msbuild/ |df=mdy |access-date=2018-04-22}}
Versions
class="wikitable" | |||
Version | .NET Framework | Visual Studio Version | Usual Install Locations (x86){{cite web |title=Standard and custom Toolset configurations |url=https://docs.microsoft.com/visualstudio/msbuild/standard-and-custom-toolset-configurations |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}} |
---|---|---|---|
2.0 | 2.0 | 2005 | C:\Windows\Microsoft.NET\Framework\v2.0.50727 |
3.5 | 3.5 | 2008 | C:\Windows\Microsoft.NET\Framework\v3.5 |
4.7.3062.0 | 4.0 | 2010 | C:\Windows\Microsoft.NET\Framework\v4.0.30319 |
4.8.3761.0 | 4.5.2 | 2012 | C:\Windows\Microsoft.NET\Framework\v4.0.30319 |
12.0{{cite web |title=What's new in MSBuild 12.0 |url=https://docs.microsoft.com/visualstudio/msbuild/what-s-new-in-msbuild-12-0 |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}} | 4.5.2 | 2013 | C:\Program Files (x86)\MSBuild\12.0\Bin |
14.0 | 4.6 | 2015 | C:\Program Files (x86)\MSBuild\14.0\Bin |
15.0{{cite web |title=What's new in MSBuild 15 |url=https://docs.microsoft.com/visualstudio/msbuild/what-s-new-in-msbuild-15-0 |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}} | 4.7 | 2017 | *C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin
|
16.0{{cite web |title=What's new in MSBuild 16.0 |url=https://docs.microsoft.com/visualstudio/msbuild/whats-new-msbuild-16-0 |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}} | 4.7.2 | 2019 | *C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
|
17.0
| |2022 |
|
Terminology
{{Confusing|section|reason=it is unclear what this section is talking about and what is the nature of, say, a "Target" or "Task". Examples would help|small=no|date=April 2013}}
;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,{{cite web |title=MSBuild task reference |url=https://docs.microsoft.com/visualstudio/msbuild/msbuild-task-reference |department=MSBuild |website=Microsoft Docs |access-date=2019-07-23}} 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
{{Portal|Free and open-source software}}
References
{{Reflist}}
Further reading
{{Refbegin}}
- {{cite book |title=MSBuild Trickery: 99 Ways to Bend the Build Engine to Your Will |year=2011 |publisher=K Cross Seven Ranch Company |isbn=978-0-615-50907-5 |last=Kretzler |first=Brian |pages=426}}
- {{cite journal |first=Sayed Ibrahim |last=Hashimi |url=http://msdn.microsoft.com/en-us/magazine/cc163589.aspx |title=Inside MSBuild: Compiling Apps With Custom Tasks For The Microsoft Build Engine |journal=MSDN Magazine |publisher=Microsoft |date=June 2006 |access-date=11 April 2013 |archive-url=https://web.archive.org/web/20150411004510/https://msdn.microsoft.com/en-us/magazine/cc163589.aspx |archive-date=11 April 2015 |url-status=dead }}
- {{cite journal |first=Sayed Ibrahim |last=Hashimi |url=http://msdn.microsoft.com/en-us/magazine/cc163456.aspx |title=WiX Tricks: Automate Releases With MSBuild And Windows Installer XML |journal=MSDN Magazine |publisher=Microsoft |date=March 2007 |access-date=11 April 2013}}
- {{cite journal |first=Sayed Ibrahim |last=Hashimi |url=http://msdn.microsoft.com/en-us/magazine/dd419659.aspx |title=MSBuild: Best Practices For Creating Reliable Builds, Part 1 |journal=MSDN Magazine |publisher=Microsoft |date=February 2009 |access-date=11 April 2013}}
- {{cite journal |first=Sayed Ibrahim |last=Hashimi |url=http://msdn.microsoft.com/en-us/magazine/dd483291.aspx |title=MSBuild: Best Practices For Creating Reliable Builds, Part 2 |journal=MSDN Magazine |publisher=Microsoft |date=March 2009 |access-date=11 April 2013}}
- {{cite web |first=Andreas |last=Reif |url=http://www.heise.de/developer/artikel/Einfuehrung-in-Microsofts-Build-Management-Technik-MSBuild-1017660.html |title=Einführung in Microsofts Build-Management-Technik MSBuild |trans-title=Introduction to Microsoft's build management technology, MSBuild |language=de |work=heise Developer |publisher=Heinz Heise |date=10 June 2010 |access-date=11 April 2013}}
- {{Cite web |last1=Jones |first1=Mike |last2=Warren |first2=Genevieve |last3=Blome |first3=Mike |last4=Robertson |first4=Colin |last5=Hogenson |first5=Gordon |last6=Cai |first6=Saisang |date=2016-11-04 |df=dmy |title=MSBuild target framework and target platform |url=https://docs.microsoft.com/visualstudio/msbuild/msbuild-target-framework-and-target-platform |department=MSBuild |website=Microsoft Docs |access-date=2018-02-19}}
{{Refend}}
External links
- {{Official website}}
{{Microsoft development tools}}
{{Microsoft FOSS}}
Category:Free and open-source software
Category:Microsoft free software
Category:Microsoft Visual Studio