Non-Concurrent builds using DevEnv.exe - visual-studio-2010

I have a requirement to use devenv.exe to build our VS2010 projects. I need the projects to build 1 at a time since running multiple builds concurrently causes issues. I have set the number of concurrent builds to 1 in Tools -> Options -> Projects & Solutions -> Build and Run. When I execute the build directly from VS2010 everything works ask expected.
------ Rebuild started: Project: project1, Configuration: Release Win32 ------
.
Compile Output
.
------ Rebuild started: Project: project2, Configuration: Release Win32 ------
.
Compile Output
.
But when I run it from the command line
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" C:\Users\Me\project\MySolution.sln /rebuild "Release|win32" /project C:\Users\Me\project\MyProject.vcxproj /out C:\DevEnv.log
It starts to the build the projects in parallel.
Microsoft (R) Visual Studio Version 10.0.30319.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Rebuild All started: Project: project1, Configuration: Release Win32 ------
2>------ Rebuild All started: Project: project2, Configuration: Release Win32 ------
3>------ Rebuild All started: Project: project3, Configuration: Release Win32 ------
4>------ Rebuild All started: Project: project4, Configuration: Release Win32 ------
Is there a flag or setting that I am missing to get these builds to run 1 at a time when using the command line?
Edit: It should be noted that I am running this build in Jenkins. When running the above command in a command prompt it seems to work fine. But running the command in Jenkins causes the build to execute in parallel. Perhaps there is some environment variable that needs to be set?

I have never seen anyone try to build a solution from the command line using devenv.exe. I think that's because devenv.exe is Visual Studio. You're probably better off using MSBuild instead. Anything VS does MSBuild should be able to do because VS uses MSBuild under the hood. And it should be able to build your solution and/or project files without modification.
Since you say you're using Jenkins for CI, check out this MSBuild plugin for Jenkins.
https://wiki.jenkins-ci.org/display/JENKINS/MSBuild+Plugin

Related

How to find exact command line for Build command using Visual Studio?

Our team has been automating the build process for a UE4 game. We are able to successfully compile all targets using Visual Studio 2019 (with the Build function), but we are having trouble finding the correct syntax for the build console command for a specific target.
We tried getting the command from the build output log, but we only found something like this:
1>------ Build started: Project: [ProjectName], Configuration: Development_Editor x64 ------
We want to know how to get the exact command that Visual Studio runs when compiling a specific target with the Build button.
Thank you

SSIS Project Builds in Visual Studio but not from Devenv Command Line

I have a Visual Studio Solution with one SSIS Project with a number of connection managers and packages. It builds fine in Visual Studio. It fails in our build automation system being built via the devenv command line:
"D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.com" ADSMetricsETL.sln /Build Release /Project "ADSMetricsETL"
Microsoft (R) Microsoft Visual Studio 2012 Version 11.0.61030.0.
Copyright (C) Microsoft Corp. All rights reserved.
------ Build started: Project: ADSMetricsETL, Configuration: Debug ------
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped =========
command exit code: 1
I get no errors from the build, just the "1 failed". I don't see any options on devenv to increase the verbosity. This solution used to build find in the build automation system. I made a couple of minor changes to one package and now it doesn't build at all.
Also, never noticed this before but why when the command line says "/Build Release" is it building "Configuration: Debug"?
Any thoughts?
One of the Connection Managers was inadvertently updated in the process. It would have been helpful if the Build gave me some indication of the error. I had to go back through the Subversion logs and inspect everything listed as changed. When I saw the Connection Manager listed I said "Huh? I didn't make changes to that Connection Manager..." I reverted the Connection Manager, committed everything and now it builds.

Rebuild fails where Clean/Build succeeds in Visual Studio 2010

I've created two projects in a solution, a static library called vm and a console application called vmx. I use the new approach of Framework and References to create the dependency of vm for vmx. I also added x64 platforms to both projects.
Now, when I select Rebuild Solution, I get this output:
1>------ Rebuild All started: Project: vm, Configuration: Debug Win32 ------
1> vm.c
1> vm.vcxproj -> D:\Shared\Dynos\Build\Visual Studio 2010\Solutions\..\..\..\Lib\Win32\Debug\vm.lib
2>------ Rebuild All started: Project: vmx, Configuration: Debug Win32 ------
2> main.c
2>LINK : fatal error LNK1104: cannot open file 'D:\Shared\Dynos\Lib\Win32\Debug\vm.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
It as if vm.lib is deleted after being built before vmx is compiled.
If I select Clean Solution, then Build Solution, I get this output:
1>------ Build started: Project: vm, Configuration: Debug Win32 ------
1> vm.c
1> vm.vcxproj -> D:\Shared\Dynos\Build\Visual Studio 2010\Solutions\..\..\..\Lib\Win32\Debug\vm.lib
2>------ Build started: Project: vmx, Configuration: Debug Win32 ------
2> main.c
2> vmx.vcxproj -> D:\Shared\Dynos\Build\Visual Studio 2010\Solutions\..\..\..\Lib\Win32\Debug\vmx.exe
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Everything is OK.
Could someone explain to me what is happening here?
Thanks
I ran into this problem recently as well, and after much head banging, I realized that the output directory was the same on several of the projects. So project A would get rebuilt fine, however when project B was "rebuilt" it would clean out the output directory including projectA's .lib and .dll files, and subsequent project rebuilds would fail.
Our fix for the moment for our auto build was to do a clean, then a build on the solution, instead of doing rebuild or clean/rebuild. Obviously the alternative would be to change the projects to each have their own output directory.
Hope that helps someone!
I found the solution to my problem. The solution is to not to use the Frameworks and References feature in project settings and JUST use the old Project Dependencies system. I removed my reference and clicked the checkbox in the Project Dependencies dialog box and it all works now. Weird!
I huess Frameworks and References is just for C# projects and should be avoided for C++ ones.
For me it was the intermediate directory that has been cleaned before the next project got built. This was really confusing, as I didn't knew what exactly will be separated into that directory and my solution and project files are all in the directory.
If you have the solution file *.sln and the referenced project files *.vcxproj all in one directory, then add $(TargetName)\ to the value of Project Properties > Configuration Properties > General > Intermediate Directory or replace it with $(Configuration)\Int\$(ProjectName)\.
This is needed for me, as I use the project in other solutions, too.
I have encountered similar problems. Certain versions of Visual Studio have this problem (see reference). I was using Visual Studio Community 2022 (64-bit) Version 17.2.6, and switched to different versions (Microsoft Visual Studio Community 2019 Version 16.11.18 and Microsoft Visual Studio Community 2022 RC (64-bit) Version 17.0.0 RC2), which fixed the problem.
1)Might be some dependency issue
OR
2)Some old intermediate files might be remaining during rebuild which
get deleted during clean & are replaced by new, correct ones during fresh build.

Devenv ProjectConfig switch - Win32 and x64

Running Visual Studio 2008 interactively, I can build the project successfully for both the x64 and Win32 targets. However, if I invoke devenv, regardless of my /projectconfig argument, it always performs the x64 build:
devenv /Rebuild Release MySolution.sln /projectconfig "Release|Win32"
Microsoft (R) Visual Studio Version 9.0.21022.8.
Copyright (C) Microsoft Corp. All rights reserved.
------ Rebuild All started: Project: my-project, Configuration: Release x64 ------
Note that the /projectconfig arg doesn't match the Configuration: output. Am I missing something simple? It works fine within the IDE but there are a bunch of targets and I'd prefer to script it.
Thanks in advance!
I'm not sure exactly why this is happening, but does it work with the following?
devenv /Rebuild "Release|Win32" MySolution.sln
Or alternatively, using msbuild:
msbuild MySolution.sln /p:Configuration=Release;Platform=Win32 /t:proj:Rebuild
Using Visual Studio 2019 to build .NET 5 solution with devenv.exe in command line:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.com SolutionName.sln /build "Release|x86" /project Project /projectconfig Release
Still did not affect on build configuration and used Any CPU instead of x86:
14:08:42 [exec] 80>------ Build started: Project: Project, Configuration: Release Any CPU ------
After dig into Project.csproj (note this is .NET 5 project file format) file I found this:
<Platforms>AnyCPU;x86;x64</Platforms>
Experimentally changed platforms order to:
<Platforms>x86;AnyCPU;x64</Platforms>
And it did the trick:
15:27:30 [exec] 80>------ Build started: Project: Project, Configuration: Release x86 ------
Hope this helps someone who uses devenv.com for assembling nowadays.

SharePoint deployment failure using VS2008 on the comannd line

I am trying to implement a nightly build environment for our SharePoint solution that includes VS 2008 and VS 2008 extensions for Windows SharePoint Services 3.0 (version 1.2).
When I deploy via the VS 2008 GUI it works fine.
When I use the command line:
c:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe SharePoint.sln /Deploy Release
I get the following error:
------ Deploy started: Project: SharePoint.Site, Configuration: Release Any CPU ------
------ Generate solution file and setup batch file ------
Creating solution ...
System.NotImplementedException
Error: The method or operation is not implemented.
Others seem to be having similar issues.
VSeWSS 1.2 doesn't support command line builds. I would either try the CTP for VSeWSS 1.3 or a community tool like STSDev or WSPBuilder.

Resources