Click here to Skip to main content
14,922,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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.
Posted

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,
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.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900