使用VB.NET进行命令行构建 [英] Command Line Build with VB.NET

查看:133
本文介绍了使用VB.NET进行命令行构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VB6中,我经常使用批处理文件来执行命令行构建.这使我可以将所有项目的``条件编译参数''设置为RELEASE构建的默认值,并覆盖项目文件中的那些设置.命令行看起来像这样-

With VB6 I often used a batch file to perform a command line build. This lets me set all of the projects'' Conditional Compilation Arguments to their default value for a RELEASE build, overriding those settings in the project file. The command line would look something like this-

Vb6.exe /make myproject.vbp /d Arg1=0:Arg2=-1:Arg3=0


我找不到VB.NET的等效项.

我使用 vbc 指定编译器开关设置,但显然不使用项目文件,这会导致大量编译错误.

使用 deveng 可以让我指定项目文件,但不能指定编译器开关设置.

有谁知道如何使用VB.NET做到这一点?

我在Windows XP中使用VS2005.


I cannot find an equivalent for VB.NET.

Using vbc let''s me specify the compiler switch settings but apparently does not use the project file, resulting in a ton of compile errors.

Using deveng let''s me specify the project file but does not let me specify the compiler switch settings.

Does anyone know how to do this with VB.NET?

I am using VS2005 in Windows XP.

推荐答案

请尝试在Visual Studio命令提示符下使用msbuild /property:Configuration=Release MyFile.vbproj.
您还可以考虑使用第三方工具,例如Nant.
Try using msbuild /property:Configuration=Release MyFile.vbproj in the Visual Studio command prompt.

You could also consider third party tools like Nant.


Abhinav S,
感谢您的快速回复.

我看了 msbuild ,有一个叫做 DefineConstants 的属性,根据许多互联网文章,可以用来设置编译器开关值.但是,在尝试了它,并且在我无法使它工作之后阅读了更多的文章之后,我发现此属性仅在构建项目文件中使用时才有效,而在命令行中不起作用.

看起来没有任何简单的方法可以做到这一点.我会更快地编写一个快速的VB程序来打开主项目文件,根据需要编辑编译器开关值,将其保存,运行 msbuild ,再次打开文件,然后将值放回原处.并保存它.

但是感谢使用 msbuild 的建议,因为它可以完成我想做的大部分工作,并且我会继续使用它.
Abhinav S,
Thanks for the quick reply.

I took a look at msbuild and there is a property called DefineConstants that, according to many internet articles, can be used to set the compiler switch values. But after trying it, and reading a couple more posts after I could not get it to work, I found out that this property only works when used inside of a build project file, not on the command line.

It does not look like there is any easy way to do this. I would be quicker to write a quick VB program to open the main project file, edit the compiler switch values as needed, save it, run msbuild, open the file again, put the values back to where they were and save it.

But thanks for the suggestion of using msbuild because it does most of what I want it to do and I will be using it.


这篇关于使用VB.NET进行命令行构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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