简体   繁体   English

使用命令行生成Visual Studio C ++项目

[英]Build a Visual Studio C++ project using the Command Line

I''ve written this batch script to build a Visual Studio C++ project using the Command Line: 我已经编写了以下批处理脚本,以使用命令行来构建Visual Studio C ++项目:

pushd C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VsDevCmd.bat
pushd F:\Master_Copy2\embedded\IFV-170\visualC12
Msbuild.exe DSP1_Emu.vcxproj

The script changes to C:\\Program Files (x86)\\ ... directory, runs the VsDevCmd.bat, and then don't complete the commands, and I don't know what's wrong. 脚本更改为C:\\ Program Files(x86)\\ ...目录,运行VsDevCmd.bat,然后不完成命令,而且我也不知道这是怎么回事。

Note: When I run these commands one by one in a Command window it runs properly and builds the project. 注意:当我在“命令”窗口中一个接一个地运行这些命令时,它将正常运行并构建项目。

Edit: @roalz pointed out that I should use Call with the batch file VsDevCmd.bat, and this solved the problem. 编辑:@roalz指出我应该将Call与批处理文件VsDevCmd.bat一起使用,这可以解决问题。

I think you need to use the call batch command to call VsDevCmd.bat from inside your batch file. 我认为你需要使用call批处理命令调用VsDevCmd.bat从您的批处理文件中。

"The CALL command will launch a new batch file context along with any specified parameters. When the end of the second batch file is reached (or if EXIT is used), control will return to just after the initial CALL statement." “ CALL命令将启动一个新的批处理文件上下文以及任何指定的参数。当到达第二个批处理文件的末尾(或者如果使用EXIT时),控制权将在初始CALL语句之后返回。”
Please see the reference here 请在这里查看参考

Another suggestion is to enclose paths containing spaces inside double quotes, ie 另一个建议是将包含空格的路径括在双引号内,即
"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools\\" “ C:\\ Program Files(x86)\\ Microsoft Visual Studio 12.0 \\ Common7 \\ Tools \\”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在命令行上构建Visual Studio 2008 C ++项目的所有配置? - How do I build all configurations of a Visual Studio 2008 C++ project on the command line? Visual Studio 2015社区命令行生成C ++项目不起作用 - Visual Studio 2015 Community command line build C++ project does not work 使用/ Command选项从命令行为visual studio C ++项目创建一个新文件 - Create a new file for visual studio C++ project from the command line using the /Command option 如何在 Visual Studio 2015 中使用 mongoose 构建 C++ 项目 - How to build a C++ project using mongoose in Visual Studio 2015 使用Visual Studio 2012构建Eclipse C ++ Docfrac项目 - Build Eclipse C++ Docfrac project using Visual Studio 2012 使用免费版 Visual C++ 从命令行构建 a.sln /.vcxproj 项目 - Build a .sln / .vcxproj project from command line with a free edition of Visual C++ 如何在 Visual Studio C++ 项目中删除单个文件的命令行选项? - How can I remove command line option for single file in the visual studio c++ project? 如何在 Windows 上通过命令行编译 Visual Studio 的 C++ 项目? - How to compile C++ project of Visual Studio through command line on windows? 如何从命令行在 Visual Studio 中构建 QT 项目 - How to build a QT-project in visual studio from command line 在Visual Studio C ++项目中使用cusp - Using cusp in a Visual Studio C++ project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM