views:

154

answers:

3

I am trying to compile my Visual Basic .NET project named Myproject.sln via command line commands.

I need to build and then to compile that solution.

I read all questions here how to do it but I couldn't make it work.

My Visual Basic .NET compiler is called vbc.exe. Any idea how I do that thing?

I am using Visual Studio 2005.

I have already read Microsoft's tutorial, "Building from the Command Line (Visual Basic)".

A: 

You could look at using MSBuild that's probably the best approach.

Your sln file is a valid MSBUild project file, so if you open the visual studio command prompt from the start menu and browse to your project location doesn't...

 c:\...\msbuild MyFile.sln

... for example, just work?

Dog Ears
Saying the sln file is a valid MSBuild file is a bit of a stretch. There's lots of information out there about crafting MSBuild files, and they're all dealing with the XML files, using the MSBuild schema, such as .csproj and .vbproj. MSBuild does understand solution files, but I wouldn't describe them as MSBuild files.
Damien_The_Unbeliever
good point, its the proj files I was thinking of!
Dog Ears
+4  A: 

The .NET framework (2 and above) comes with a command line build utility called MSBuild. You can use this to build your visual studio project/solution files.

From the command line.

msbuild Myproject.sln
Shannon Cornish
+1, You may also need to set up your environment for this with vcvarsall.bat (e.g. "c:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat")
orip
Visual Studio comes with a command prompt already configured via the Start Menu, something like 'Visual Studio 2005 Command Prompt'However, if you don't want to use that, MSBuild lives inside the C:\Windows\Microsoft.NET\Framework\V2.0.50727 folder.
Shannon Cornish
Hi I added path where that file located on my pc to system variables,but still that command not recognized .
Night Walker
Opening up the 'Visual Studio Command Prompt' works fine here. Just type msbuild (on it's own) and you should get a msbuild error message about misssing parameters.
Dog Ears
+1  A: 

Can't you just run msbuild and specify the sln file as a command line option ?

msbuild myproject.sln /p:buildmode=release
Frederik Gheysels