Command line compiling VB.NET project via Visual S

2020-04-11 10:12发布

问题:

I am trying to compile my Visual Basic .NET project named Myproject.sln via command line commands. I need to build and compile that solution.

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

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

回答1:

The .NET framework (version 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


回答2:

Just run MSBuild and specify the .sln file as a command line option:

msbuild myproject.sln /p:buildmode=release


回答3:

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,

 c:\...\msbuild MyFile.sln

... for example, it should just work.