{"id":4123,"date":"2010-01-11T13:46:00","date_gmt":"2010-01-11T13:46:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2010\/01\/11\/vcbuild-vs-c-msbuild-on-the-command-line\/"},"modified":"2019-02-18T18:45:41","modified_gmt":"2019-02-18T18:45:41","slug":"vcbuild-vs-c-msbuild-on-the-command-line","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/vcbuild-vs-c-msbuild-on-the-command-line\/","title":{"rendered":"VCBuild vs. C++ MSBuild on the Command Line"},"content":{"rendered":"<p class=\"MsoNormal\"><span>In Visual Studio 2010, the command line tool vcbuild.exe will be replaced by msbuild.exe. The executable change does mean switches will change, too.&nbsp; To help make the migration easier, I have created this table as a quick guide to the new switches and highlight some differences between the tools.&nbsp; The table below isn&rsquo;t a complete table of all the switches provided in both tools.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Migrating to MSBuild requires a new project type with a different extension (vcxproj).&nbsp; Visual Studio comes with two tools for converting existing projects and solutions.&nbsp; When dealing with a single project, the &ldquo;vcupgrade.exe &lt;filename&gt;.vcproj&rdquo; tool provides a quick conversion.&nbsp; When dealing with multiple projects in a solution, use devenv to converts the whole solutions (.sln) and all of the projects within.&nbsp; Once the project or solution has been converted without errors, you can use MSBuild.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>When invoked with no explicit project configuration, VCBuild used to build all Configuration and Platform matrix by default, MSBuild, in contrast, builds only the default &ldquo;Debug | Win32&rdquo;.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>In MSBuild, any feature that is enabled by \/p[roperty] switch can also be enabled by setting the environment variable with the respective name.&nbsp; For an example, &ldquo;set Configuration=Debug&rdquo; in the command line is the same as passing &ldquo;\/p:Configuration=Debug&rdquo; to all MSBuild execution.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>[] = optional characters to help remember the switch<\/p>\n<p><\/span><\/p>\n<table class=\"MsoNormalTable\" cellspacing=\"0\" cellpadding=\"0\" width=\"655\" border=\"0\">\n<tbody>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Build Project<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>VCBuild.exe &lt;projectname.vcproj&gt;<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>MSBuild.exe &lt;projectname.vcxproj&gt;<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Build Solution<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>VCBuild.exe &lt;solutionname.sln&gt;<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>MSBuild.exe &lt;solutionname.sln&gt;<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Rebuild<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/rebuild<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t[arget]:rebuild<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Clean<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/clean<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t[arget]:clean<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span><font size=\"3\">Use Environment variables for INCLUDE and LIB<\/p>\n<p><\/font><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/useenv<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/p[roperty]:useenv=true<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Multi-processor build *<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/m#<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/m:#<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Platform<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span><font size=\"3\">\/platform:&lt;platform&gt;<\/p>\n<p><\/font><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/p:Platform=&lt;platform&gt; <\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Configuration<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span><font size=\"3\">&lt;configuration&gt;<\/p>\n<p><\/font><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/p:Configuration=&lt;configuration&gt;<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Force Link (Link will always execute)<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/forcelink<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t:BuildLink<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span>Passes<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/pass0<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t:BuildGenerateSources<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/pass1<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t:BuildCompile<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"139\">\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"265\">\n<p class=\"MsoNormal\"><span>\/pass2<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"251\">\n<p class=\"MsoNormal\"><span>\/t:BuildLink \/p:BuildType=Build<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>(BuildType property enables the incremental build tracking)<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span>* Command line build are defaulted to use a single node (\/m:1).&nbsp; We encourage using n nodes where n is equal to the number of cores on the machine.&nbsp; <\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>MSBuild specific switches<\/p>\n<p><\/span><\/p>\n<table class=\"MsoNormalTable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n<tbody>\n<tr>\n<td class=\"\" valign=\"top\" width=\"95\">\n<p class=\"MsoNormal\"><span>Single File Build (Selected File Build)<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"206\">\n<p class=\"MsoNormal\"><span>Specify the files and tool&rsquo;s target name that would execute upon the files. **<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"318\">\n<p class=\"MsoNormal\"><span>\/t:&lt;toolname&gt; \/p:SelectedFiles=&rdquo;&lt;files&gt;&rdquo;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>\/t:ClCompile<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>\/p: SelectedFiles=&rdquo;StdAfx.cpp;main.cpp&rdquo;<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"95\">\n<p class=\"MsoNormal\"><span>Preprocess project file<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"206\">\n<p class=\"MsoNormal\"><span>Aggregate the project file by inlining all the files that would be imported during a build.&nbsp; This doesn&rsquo;t actually perform a build.<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"318\">\n<p class=\"MsoNormal\"><span>\/PreProcess&lt;:file&gt; or \/pp&lt;:fi<a class=\"\" name=\"_GoBack\"><\/a>le&gt;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>\/pp:outfile.txt<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"95\">\n<p class=\"MsoNormal\"><span>File logging<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"206\">\n<p class=\"MsoNormal\"><span>Logs the build into msbuild.log. See msbuild help for more information and options.<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"318\">\n<p class=\"MsoNormal\"><span>\/FileLogger or \/fl<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"95\">\n<p class=\"MsoNormal\"><span>Verbosity<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"206\">\n<p class=\"MsoNormal\"><span>Silence or increase details about the build.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Quiet and would barely show<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"318\">\n<p class=\"MsoNormal\"><span>\/V[erbosity]:(q[uiet], m[inimal], n[ormal], d[etailed], or diag[nostic])<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"\" valign=\"top\" width=\"95\">\n<p class=\"MsoNormal\"><span>Detailed Summary<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"206\">\n<p class=\"MsoNormal\"><span>Provide statistics and summary at the end of build.<\/p>\n<p><\/span><\/p>\n<\/td>\n<td class=\"\" valign=\"top\" width=\"318\">\n<p class=\"MsoNormal\"><span>\/DetailedSummary or \/ds<\/p>\n<p><\/span><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"MsoNormal\"><span><\/p>\n<p>&nbsp;<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>** At this time, I can&rsquo;t provide a list of tools, but there will be a complete list of possible targets on MSDN when it is ready.<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>If I have missed any options that you feel are important enough to go onto this list, please comment below.&nbsp; I have left out many possible switches in order to emphasis the commonly used ones.&nbsp; For further references, consider these links below:<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>MSBuild Command Line Reference &#8211; <\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms164311.aspx\"><span><font color=\"#0000ff\">http:\/\/msdn.microsoft.com\/en-us\/library\/ms164311.aspx<\/font><\/span><\/a><span><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>VC++ Building on the Command Line &#8211; <\/span><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/f35ctcxw%28VS.100%29.aspx\"><span><font color=\"#0000ff\">http:\/\/msdn.microsoft.com\/en-us\/library\/f35ctcxw%28VS.100%29.aspx<\/font><\/span><\/a><span> <\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>The New VC++ Project\/Build system &#8211; <\/span><a href=\"https:\/\/channel9.msdn.com\/posts\/Charles\/Bogdan-Mihalcea-The-New-VC-ProjectBuild-system-MSBuild-for-C\/\"><span><font color=\"#0000ff\">https:\/\/channel9.msdn.com\/posts\/Charles\/Bogdan-Mihalcea-The-New-VC-ProjectBuild-system-MSBuild-for-C\/<\/font><\/span><\/a><span><\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>Felix Huang<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\"><span>VC Project &amp; Build Team<\/p>\n<p><\/span><\/p>\n<p class=\"MsoNormal\">\n<p><font face=\"Calibri\" size=\"3\">&nbsp;<\/font><\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Visual Studio 2010, the command line tool vcbuild.exe will be replaced by msbuild.exe. The executable change does mean switches will change, too.&nbsp; To help make the migration easier, I have created this table as a quick guide to the new switches and highlight some differences between the tools.&nbsp; The table below isn&rsquo;t a complete [&hellip;]<\/p>\n","protected":false},"author":289,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[53,13,54,33],"class_list":["post-4123","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-command-line","tag-msbuild","tag-vc-project-system","tag-vcbuild"],"acf":[],"blog_post_summary":"<p>In Visual Studio 2010, the command line tool vcbuild.exe will be replaced by msbuild.exe. The executable change does mean switches will change, too.&nbsp; To help make the migration easier, I have created this table as a quick guide to the new switches and highlight some differences between the tools.&nbsp; The table below isn&rsquo;t a complete [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/4123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/289"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=4123"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/4123\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=4123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=4123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=4123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}