32

I'm attempting to compile a visual studio solution using devenv.exe from the command line. I can get it to work but all the projects in the solution are compiled for AnyCPU and I want them to be compiled for x86. Both the debug and release configurations are set to x86 for all projects.

When I compile from within the IDE it works fine. But when I try to build the solution from the command line it always builds all projects for AnyCPU. Is there a way to devenv.exe to build in x86 only?

We are using Visual Studio 2012

user2687412
  • 353
  • 1
  • 3
  • 6

2 Answers2

53
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" myproject.sln /Build "Release|x86
Foad S. Farimani
  • 12,396
  • 15
  • 78
  • 193
  • 2
    That did the trick. The "release|x86" syntax doesn't seem to be in the Microsoft documentation any where. In any case thanks for your help – user2687412 Sep 26 '13 at 20:26
  • 6
    You probably don't care any more, but if you don't want to wait until the compilation has finished, use devenv.com instead of .exe. – Wai Ha Lee Jun 10 '16 at 11:01
  • devenv.com also sets the ERRORLEVEL, so you can check for success or failure in your build script. – MikeOnline Oct 01 '21 at 20:28
1

You can for sure use this command: devenv /? it will show you everything you want to know and even more.

This is taken from devenv /?

/Build Builds the solution or project with the specified solution configuration. For example "Debug". If multiple platforms are possible, the configuration name must be enclosed in quotes and contain platform name. For example: "Debug|Win32".

enter image description here

Ayman Salah
  • 1,039
  • 14
  • 35
  • 1
    The canonical help flag in Windows is `/?`, not `--help`. (In this case `--help` works because it displays the help message whenever you specify an invalid flag.) – 0x5453 Jul 05 '17 at 13:58
  • You're 100% right :D it even says `Unknown switch : -help`. I have updated my answer, Thanks a lot. – Ayman Salah Jul 05 '17 at 16:58