visual studio命令行编译工程

时间:2021-12-18 17:46:21

visual studio命令行编译工程方案

devenv -h
msbuild -h

----------Visual Studio 2005 Command
Prompt-------------------------------------
Setting environment for using Microsoft Visual Studio 2005 x86 tools.

C:/Program Files/Microsoft Visual Studio 8/VC>devenv -h

Microsoft (R) Visual Studio Version 8.0.50727.42.
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Invalid Command Line. Unknown Switch : h.

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 Ad
d-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>

C:/Program Files/Microsoft Visual Studio 8/VC>msbuild -h
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Syntax:              MSBuild.exe [options] [project file]

Description:        Builds the specified targets in the project file. If
                    a project file is not specified, MSBuild searches the
                    current working directory for a file that has a file
                    extension that ends in "proj" and uses that file.

Switches:

  /help              Display this usage message. (Short form: /? or /h)

  /nologo            Do not display the startup banner and copyright
message.

  /version          Display version information only. (Short form: /ver)

 

@<file>            Insert command-line settings from a text file. To specify
                    multiple response files, specify each response file
                    separately.

  /noautoresponse    Do not auto-include the MSBuild.rsp file. (Short form:
                    /noautorsp)

  /target:<targets>  Build these targets in this project. Use a semicolon or
a
                    comma to separate multiple targets, or specify each
                    target separately. (Short form: /t)
                    Example:
                      /target:Resources;Compile

  /property:<n>=<v>  Set or override these project-level properties. <n> is
                    the property name, and <v> is the property value. Use a
                    semicolon or a comma to separate multiple properties,
or
                    specify each property separately. (Short form: /p)
                    Example:
                      /property:WarningLevel=2;OutDir=bin/Debug/

  /logger:<logger>  Use this logger to log events from MSBuild. To specify
                    multiple loggers, specify each logger separately.
                    The <logger> syntax is:
                        [<logger class>,]<logger assembly>[;<logger
parameters>]

                    The <logger class> syntax is:
                        [<partial or full namespace>.]<logger class name>
                    The <logger assembly> syntax is:
                        {<assembly name>[,<strong name>] | <assembly file>}
                    The <logger parameters> are optional, and are passed
                    to the logger exactly as you typed them. (Short form:
/l)
                    Examples:
                      /logger:XMLLogger,MyLogger,Version=1.0.2,Culture=neutral
                      /logger:XMLLogger,C:/Loggers/MyLogger.dll;OutputAsHTML

visual studio命令行编译工程

 

  /verbosity:<level> Display this amount of information in the event log.
                    The available verbosity levels are: q[uiet], m[inimal],
                    n[ormal], d[etailed], and diag[nostic]. (Short form:
/v)
                    Example:
                      /verbosity:quiet

  /consoleloggerparameters:<parameters>
                    Parameters to console logger. (Short form: /clp)
                    The available parameters are:
                        PerformanceSummary--show time spent in tasks,
targets
                            and projects.
                        NoSummary--don't show error and warning summary at
the
                            end.
                        NoItemAndPropertyList--don't show list of items and
                            properties at the start of each project build.

                    Example:
                        /consoleloggerparameters:PerformanceSummary;NoSummary

  /noconsolelogger  Disable the default console logger and do not log
events
                    to the console. (Short form: /noconlog)

  /validate          Validate the project against the default schema. (Short
                    form: /val)

  /validate:<schema> Validate the project against the specified schema.
(Short
                    form: /val)
                    Example:
                      /validate:MyExtendedBuildSchema.xsd

Examples:

        MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release
        MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug

如果上面没看懂, 给你举个例子:

首先配置使用Visual Studio 环境

call "C:/Program Files/Microsoft Visual Studio 8/VC/vcvarsall.bat"

此示例使用 solution-TSRERelease解决方案配置中的 TestMP项目生成配置

devenv "D:/Project/TSRE3.6_rmsvr/TSRE2.sln"/build Release /project "D:/Project/TSRE3.6_rmsvr/TestMP.vcproj"