Chinaunix首页 | 论坛 | 博客
  • 博客访问: 308635
  • 博文数量: 47
  • 博客积分: 2455
  • 博客等级: 大尉
  • 技术积分: 558
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-25 15:43
文章分类

全部博文(47)

文章存档

2016年(2)

2012年(10)

2011年(13)

2010年(1)

2009年(19)

2008年(2)

分类: WINDOWS

2009-04-18 01:10:49

msdev是visual studio 6.0的IDE程序, devenv是visual studio 2005的IDE程序
两种IDE程序, 既可以工作在图形模式下,也可以工作在命令模式下.
其中, 直接运行msdev 和 devenv将打开vs6和vs2005的IDE界面. 命令行则支持不同的选项.

Msdev的命令行用法:
Usage:
  MSDEV [myprj.dsp|mywksp.dsw]  - load project/workspace
        []            - load source file
        /?                      - display usage information
        /EX          - execute a VBScript macro
        /OUT          - redirect command line output to a file
        /USEENV                 - ignore tools.options.directories settings
        /MAKE [] [...]  - build specified target(s)
              [ - ]
              [[|ALL] - [DEBUG|RELEASE|ALL]]
              /CLEAN            - delete intermediate files but don't build
              /REBUILD          - clean and build
              /NORECURSE        - don't build dependent projects
比如我对BerkeleyDB而言, 4.7.25自带了一个Berkeley_DB.dsw, 此工程文件由包含很多的子项目.
编译所有项目Debug版本为:
  msdev Berkeley_DB.dsw /make "all - Win32 Debug x86"
其中有一个project有许多其他projects组成,就是build_all, 包含了C/C++的动态库,各种工具程序,还有各种示例程序. 编译此project Debug版本就为:
  msdev Berkeley_DB.dsw /make "build_all - Win32 Debug x86"
如果还想编译Java的动态库, 在vc6中设置好java后, 运行如下命令即可:
  msdev Berkeley_DB.dsw /make "db_java - Win32 Debug x86"
在工程文件外,还有一个用来衡量性能的程序, test_micro,编译该程序的命令为:
 msdev test_micro.dsp /make "test_micro - Win32 Debug x86"
即,对于项目文件而言, 其只有一个project, 就是其本身.

对于自动化程序而言, msdev有一个弊端,就是程序返回值.  当项目文件/工程文件不存在的时候, msdev的返回值居然是0!, 和编译成功的一样, 也许msdev认为不存在就是成功吧.


devenv命令的格式就长了一点, 基本语法是:
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将文件不存在视为编译失败. 更加适合程序处理.


附: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
 
阅读(4440) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~