Using devenv.exe from the command line and specifying the platform
Asked Answered
W

2

34

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

Warmongering answered 19/9, 2013 at 18:46 Comment(0)
A
55
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" myproject.sln /Build "Release|x86
Aparejo answered 19/9, 2013 at 18:50 Comment(3)
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 helpWarmongering
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.Electromotive
devenv.com also sets the ERRORLEVEL, so you can check for success or failure in your build script.Patter
C
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

Cogon answered 23/2, 2017 at 10:16 Comment(2)
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.)Storybook
You're 100% right :D it even says Unknown switch : -help. I have updated my answer, Thanks a lot.Cogon

© 2022 - 2024 — McMap. All rights reserved.