简体   繁体   中英

How to Build a Visual Studio 2015 vb solution from command line in Windows 10

this might be a really simple question (the content covered in the following question is new to me), but how do I build and run a Visual Studio solution (written in visual basic, not sure if that matters), from the Command Prompt window in Windows 10? I've tried searching the internet, but for so many answers none of them seem to work. I've tried devenv and /build and either get a 'devenv is not recognized as an internal or external command, operable program or batch file.' error or 'The filename, directory name, or volume label syntax is incorrect' error. Let me know how I can clarify this question. Thanks!

You need to use msbuild in order to build your project or solution.

Steps:

  1. Locate Msbuild.exe (For Visual studio 2015, default locaiton is: C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild.exe)
  2. Open a command line, then execute:

.

%Msbuild% %VBProj% /p:Configuration=Release

You will have to replaces %Msbuild% by the full path of your msbuild.exe and %vbproj% by the full path of the vbproj or SLN file you want to build.

As for the last argument, it is used to specify that you want to build the Release version.

Here is an example according to my environment

C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\Users\MyUser\Documents\Visual Studio 2015\Projects\WpfApplication2\WpfApplication2.sln" /p:Configuration=Release

In this example, I specified the path of my Visual studio 2015 along with the Solution I wanted to build (WpfApplication2) and specified I wanted the release build.

For a complete list of all the switches you can use, see the official documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM