I'm having a problem trying to building a Visual Studio 2005 solution (.sln) from the command line using devenv. To narrow down the problem, I used the MFC DLL wizard to create a simple DLL project and solution named BuildTest. Using the default project type of Win32, from within the Visual Studio IDE I can build the Debug and Release versions of the app successfully. However, in a DOS window opened on the project directory, if I run the following command:
devenv c:\temp\BuildTest\BuildTest.sln /build "Release|Win32" /log c:\BuildTestLog.txt
I get the following error message:
The operation could not be completed. Unspecified error
The error message was followed by a dump of the command line options. The only obvious error listed in the log file BuildTestLog.txt is this:
<entry>
<record>34</record>
<time>2006/03/28 19:12:59.907</time>
<type>Error</type>
<source>Microsoft Visual Studio</source>
<description>Leaving function VStudioMain</description>
<hr>80004005 - E_FAIL</hr>
</entry>
If I try using the command line to simply open the solution in the IDE, it's successful – i.e. the following command works:
devenv c:\temp\BuildTest\BuildTest.sln
I've tried various permutations of the build command, including using /rebuild, building the Debug build, not including Win32 in the build argument, building from the project directory, all without success. Does anyone have any ideas as to what I might be doing wrong

Problem building C++ solution from command line using devenv
Kaloyan Georgiev
Like you, I use an Ant script to build my projects, or at least I use one for my eVC++ projects and was trying to use an updated version of the script to build my VS projects when I ran into this problem. I ported all my projects (approx. 40 or so) using the Wizard, but not one of these projects didn't require tweaking of some kind or another before they would successfully build.
However, remember that I'm also seeing this problem with a project I created from scratch using the VS New Project wizard. I didn't add any code to this project – I took what the wizard generated. This dummy project builds fine from within the IDE, but from the command line it doesn't seem to even get to the compile stage before I get the "Unspecified error". Based on your comments, I created another empty project using the New Project wizard that did not contain MFC to see if MFC might be causing this, but I got the same results as with my original dummy project. So I'm still stuck (I haven't tried re-installing yet), but thanks again for taking the time to respond.
Art
russ_mac
I have a rather complex Ant script that makes the build completely outside the IDE. It calls evc.exe (for emulator x86 release) and devenv.exe (for ARM release) to produce EXEs and DLLs, and generates INF file on the fly to build the CAB file. I do not have your issue that devenv.exe fails if invoked from command line. So probably the issue is your project setting. Read on...
How do you migrate your projects from EVC++ 4 to VS2005, using the Upgrade Wizard, or manually I went through the same pain, and finally took the manual migration approach. It was not that bumpy, but you need to take care a few issues on the project settings. You can learn my lesson here: Manually migrate Embedded Visual C++ workspace to Visual Studio 2005 (Beta 2) without using Migration Assistant (Upgrade Wizard).
I have about 20 projects. It took me some time to do the manual migration. But no headaches once done. Besides, after you manually migrate the first project, you get more experienced.
Now what is the difference between us I do not use MFC, but I do not see that is an issue. MFC source codes, libs, and runtime DLLs are shipped with VS2005, although the Redmond guys really do not want you to use MFC ;) Take a look at how I resolved a small issue related to MFC for one of the Pocket PC sample: TransportDemo sample in Pocket PC 5.0 SDK does not work
---
Lao K
Visit my Blog for Windows Mobile Pocket PC Smartphone Programming Hints and Tips
Denham
Are you building for windows mobile devices If so, why "WIN32" is used as the platform
Anyway your problem seems not related to that platform setting, as you can build within IDE. How about launching the build from "Visual Studio Command Prompt" If it works, check your environmental variable to see whether you have those needed by VS2005, like VS80COMNTOOLS, and etc.
Last resort: Try uninstall VS2005 and reInstall it. No kidding. Last time I saw numerous weird "Unspecified error" dialog boxes, I just remove it and reinstall it.
---
Lao K
Visit my Blog for Windows Mobile Pocket PC Smartphone Programming Hints and Tips
RudolfT
Swanand
Actually, I originally ran into this problem with projects that I've ported from eVC++ 4 to Visual Studio 2005 that are for the PPC 2003 (ARMV4) platform. I decided to create a project/solution from scratch in VS to see whether it had the same problem, or whether the command line build problem was due to something funky in my ported projects. I stuck with the Win32 platform because the wizard doesn't give you the option to select a platform, and when I tried to use the VS Configuration Manager to change the project from Win32 to ARMV4, the resulting project wouldn't build.
(BTW, that's another issue – there doesn’t appear to be a way to create an MFC/C++ based project for mobile platforms from scratch in VS. I guess the boys from Redmond really, really want you to abandon C++ in favor of C#. Lucky me, at least I've got my ported VS C++ projects that I can use as templates for new C++ projects…)
Anyway, I tried your suggestion about issuing the command from the "Visual Studio Command Prompt", but got the same result. I may have to give the re-install a try. Thanks for your help.