VS2010 VC中将使用msbuild 替代 vcbuild -- 翻译自 vcblog (1)

(本文英文原贴地址:http://blogs.msdn.com/vcblog/archive/2010/01/11/vcbuild-vs-c-msbuild-on-the-command-line.aspx) 纯属翻译,如有不同,纯属错漏。 :-)

  

VC10 中将使用msbuild 替代 vcbuild 来build 工程。本文使用如下的表格展示两个命令某些选项 (switch) 的不同。需要注意的是,这个表格并非包括所有的选项.

 

MSBuild 编译对象是 vs2010 中使用的新的 vc 工程类型 vcxproj. vs 提供了两个工具来转换之前的vc 工程到 vcxproj.

1. 当处理一个单独的工程时,"vcupgrade.exe <filename>.vcproj" 可以提供快速的转换。

2. 当需要处理一个 solution 里的多个工程时,devenv 可以帮助您。

当工程转换没有错误时,就可以用msbuild.exe 来编译新工程了。

 

当没有指定特定的工程 configuration 时,vcbuild 会编译出所有 configuration 和 platform 的组合。但是 msbuild 只在默认的 "Debug | Win32" 配置下编译。

 

在 Msbuild 里,通过 /p[roperty] 指定的选项都可以通过设置环境变量来代替。 例如:"set Configuration=Debug" 相当于 Msbuild 命令里设置了 "/p:Configuration=Debug".

 

Build Project

VCBuild.exe <projectname.vcproj>

MSBuild.exe <projectname.vcxproj>

Build Solution

VCBuild.exe <solutionname.sln>

MSBuild.exe <solutionname.sln>

Rebuild

/rebuild

/t[arget]:rebuild

Clean

/clean

/t[arget]:clean

Use Environment variables for INCLUDE and LIB

/useenv

/p[roperty]:useenv=true

Multi-processor build *

/m#

/m:#

Platform

/platform:<platform>

/p:Platform=<platform>

Configuration

<configuration>

/p:Configuration=<configuration>

Force Link (Link will always execute)

/forcelink

/t:BuildLink

Passes

/pass0

/t:BuildGenerateSources

 

/pass1

/t:BuildCompile

 

/pass2

/t:BuildLink /p:BuildType=Build

(BuildType property enables the incremental build tracking)

 * 处理器选项的默认设置是单节点(/m:1)。 建议设置成机器实际的处理器数目。

 

MSBuild 中独有的选项。 

Single File Build (Selected File Build)

Specify the files and tool’s target name that would execute upon the files. **

/t:<toolname> /p:SelectedFiles=”<files>”

 

/t:ClCompile

/p: SelectedFiles=”StdAfx.cpp;main.cpp”

Preprocess project file

Aggregate the project file by inlining all the files that would be imported during a build.  This doesn’t actually perform a build.

/PreProcess<:file> or /pp<:file>

 

/pp:outfile.txt

File logging

Logs the build into msbuild.log. See msbuild help for more information and options.

/FileLogger or /fl

Verbosity

Silence or increase details about the build.

Quiet and would barely show

/V[erbosity]:(q[uiet], m[inimal], n[ormal], d[etailed], or diag[nostic])

Detailed Summary

Provide statistics and summary at the end of build.

/DetailedSummary or /ds

你可能感兴趣的:(File,Build,include,2010,statistics,variables)