如何使用批处理文件构建解决方案 [英] How to build solution using batchfile

查看:109
本文介绍了如何使用批处理文件构建解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用批处理文件构建.NET解决方案.

I want to build .NET solution using batch file.

我知道我需要使用以下声明

I am aware that I need to use following statement

devenv /build release "D:\Source Code\Source\test.sln"

但是我不知道如何创建将在VS命令提示符下执行的批处理文件.

But I do not know how to create batch file which will execute on VS command prompt.

推荐答案

visual studio命令提示符仅加载一些变量和路径设置.就是这样,没有什么特别的,它不是不同的命令提示符,它是配置了某些设置的相同命令提示符.您可以通过在顶部添加以下行来在自己的批处理文件中加载相同的设置:

The visual studio command prompt just loads some variables and path settings. That's all it is, it's nothing specially, it's not a different command prompt, it's the same command prompt with some settings configured. You can load the same settings in your own batch file by including the following line at the top:

call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

(显然,对于不同版本的VS,路径可能会略有变化)

(Obviously, for different versions of VS, the path might change slightly)

您可以将"x86"替换为适合您计算机的体系结构.允许的值为:

You can replace "x86" with the appropriate architecture for your machine. The permitted values are:

  • x86
  • amd64
  • x64
  • ia64
  • x86_amd64
  • x86_ia64

也就是说,我认为您实际上不需要加载所有vars/paths,而您真正需要做的只是提供devenv.exe文件的完整路径.您可以尝试以下方法:

That said, I don't think you actually need to load all the vars/paths all you really need to do is provide the full path to the devenv.exe file. You could try this instead:

"c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /build release "D:\Source Code\Source\test.sln"

(同样,路径会因Visual Studio的不同版本而改变)

(Again, the path will change for different versions of visual studio)

这篇关于如何使用批处理文件构建解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆