VS命令行编译

需要把denenv.com的路径设置到系统的PATH目录当中,否则需要写出devenv完整的路径

上几个例子:

重新编译整个解决方案,release win32模式

devenv E:/xx/yy/zz.sln /Rebuild "Release|Win32"


编译解决方案,Debug模式

devenv E:/xx/yy/zz.sln /build "Debug|Win32"






附:devenv的命令行帮助
Microsoft (R) Visual Studio Version 8.0.50727.762.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Use:
devenv  [solutionfile | projectfile | anyfile.ext]  [switches]

The first argument for devenv is usually a solution file or project file.
You can also use any other file as the first argument if you want to have the
file open automatically in an editor. When you enter a project file, the IDE
looks for an .sln file with the same base name as the project file in the
parent directory for the project file. If no such .sln file exists, then the
IDE looks for a single .sln file that references the project. If no such single
.sln file exists, then the IDE creates an unsaved solution with a default .sln
file name that has the same base name as the project file.

Command line builds:
devenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [ /projectconfig name ] ]
Available command line switches:

/Build        Builds the solution or project with the specified solution
        configuration. For example "Debug". If multiple platforms
        are possible, the configuration name must be enclosed in quotes
        and contain platform name. For example: "Debug|Win32".
/Clean        Deletes build outputs.
/Command    Starts the IDE and executes the command.
/Deploy        Builds and then deploys the specified build configuration.
/Edit        Opens the specified files in a running instance of this
        application. If there are no running instances, it will
        start a new instance with a simplified window layout.
/LCID        Sets the default language in the IDE for the UI.
/Log        Logs IDE activity to the specified file for troubleshooting.
/NoVSIP        Disables the VSIP developer's license key for VSIP testing.
/Out        Appends the build log to a specified file.
/Project    Specifies the project to build, clean, or deploy.
        Must be used with /Build, /Rebuild, /Clean, or /Deploy.
/ProjectConfig    Overrides the project configuration specified in the solution
        configuration. For example "Debug". If multiple platforms are
        possible, the configuration name must be enclosed in quotes
        and contain platform name. For example: "Debug|Win32".
        Must be used with /Project.
/Rebuild    Cleans and then builds the solution or project with the
        specified configuration.
/ResetAddin    Removes commands and command UI associated with the specified Add-in.
/ResetSettings    Restores the IDE's default settings, optionally resets to
        the specified VSSettings file.
/ResetSkipPkgs    Clears all SkipLoading tags added to VSPackages.
/Run        Compiles and runs the specified solution.
/RunExit    Compiles and runs the specified solution then closes the IDE.
/SafeMode    Launches the IDE in safe mode loading minimal windows.
/Upgrade    Upgrades the project or the solution and all projects in it.
        A backup of these files will be created as appropriate.  Please
        see Help on 'Visual Studio Conversion Wizard' for more
        information on the backup process.

Product-specific switches:

/debugexe    Open the specified executable to be debugged. The
        remainder of the command line is passed to this
        executable as its arguments.
/useenv        Use PATH, INCLUDE, LIBPATH, and LIB environment variables
        instead of IDE paths for VC++ builds.

To attach the debugger from the command line, use:
    VsJITDebugger.exe -p <pid>

参考http://blog.chinaunix.net/u2/89624/showart_1903053.html

基本语法是:
devenv  [solutionfile | projectfile | anyfile.ext]  [switches]
比如, 为了方便VC2005以上的编译, BerkeleyDB将会同时提供vc6所用的dsw文件同时, 也会推出一个sln文件,这sln文件就是solutionfile
使用此文件编译BerekleyDB默认配置的Debug版本为:
 devenv Berkeley_DB.sln /build "Debug|Win32"
只编译db的动态库则为:
 devenv Berkeley_DB.sln /build "Debug|Win32" /project db
编译test_micro则复杂点,因为vc2005默认的project file是.vcproj的,而不是.dsp格式的,而test_micro只有.dsp格式的故而,需要先转化为.vcproj格式的, 可以用VCBuild工具:
VCBuild test_micro.dsp /upgrade
这样就产生了test_micro.vcproj
用devenv编译就是:
 devenv test_micro.vcproj /build "Debug x86|Win32"
  之所有配置与上面不同在与, test_micro中是适用于VC6的配置, 转化过来以后, 配置是保留的.

与msdev不同, devenv将文件不存在视为编译失败. 更加适合程序处理.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值