Devenv ProjectConfig switch - Win32 and x64 - visual-studio

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.

Related

Creating a build for Visual Studio Deployment Project via command prompt

I am having issues with trying to create a Visual Studio Deployment Project via command prompt.
I have a visual studio 2015 installer I am trying to create, I am running the following command:
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<InstallerProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
I also read that maybe the dependent projects need to be built as well, so I have also tried that as follows:
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<ProjectName>.vbproj" /ProjectConfig "Release|Any CPU" /Project "<InstallerProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
No matter what I have tried the installer project does not build and it gives an error (pop's up the Microsoft visual studio helper window)
If I run the code without the installer such as the follow that project will be built just fine.
devenv.exe <SolutionName>.sln /Build "Release|Any CPU" /Project "<ProjectName>.vbproj" /ProjectConfig "Release|Any CPU"
What I am missing to get the installer project to build?
clarity:
- for devenv.exe I am pointing straight to the devenv.exe for VS 2015, I do have multiple versions of VS installed
- I am using "" around the locations paths to deal with the spaces in the names
- language is VB.Net
Suggestions that help to locate the cause of issue and then resolve it.
1.Try using devenv.com instead of devenv.exe, so that you can quickly get output info.
See this: Using devenv.exe directly prevents output from appearing on the console.
2.For installer project, it doesn't have platform like Any Cpu. See this:
For Release|Any Cpu solution configuration, the installer project(Setup1) doesn't have Any CPU project platform by default. Which mean your /ProjectConfig "Release|Any CPU" is not valid. I think it can build if you changes it to be /ProjectConfig Release
3.And make sure your path is all right. For me, I opened Developer Command Prompt for VS2015 and then navigate to solution folder by cd C:/solutionPath. Then i use command like this to build the installer project:
Normally the project file is in SolutionPath/ProjectName(one folder)/projectName.vdproj, so I use InstallerProjectName\InstallerProjectName.vdproj instead of InstallerProjectName.vdproj. (You may need to correct the InstallerProjectName.vbproj to InstallerProjectName.vdproj in your question...)
And now the devenv command will actually try to build the installer project. And if you meet HRESULT='8000000A', it's known issue about installer project. Check my another issue for more details to resolve that. (For VS2015, you should use corresponding way of VS2015)
Hope it helps:)

VS 2017 .NET Standard Class Library build error when trigger from TFS (VSTS)

My sln is built in VS2017 and contains several .Net Standard class library dll. Build always works successfully in my local machine/virtual machine, with VS UI or just use devenv.com via command-line.
But, when I use TFS to create build task, error about InternalVisibleTo shows.
When I use MSBuild,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "C:\WorkArea\xxxxx\_work\1\s\xxxxx\Main\Source\xxxx.sln" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"C:\WorkArea\xxxxx\tasks\MSBuild\1.0.55\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=30268741-631d-4ac8-b4d2-d5b2774b61e7|SolutionDir=C:\WorkArea\xxxxx\_work\1\s\xxxx\Main\Source"*ForwardingLogger,"C:\WorkArea\xxxxx\tasks\MSBuild\1.0.55\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="Any CPU" /p:configuration="Debug" /p:_MSDeployUserAgent="TFS_6e1df8d0-1a29-425d-803c-d70779d0c76a_build_3175_345868"
it has the error:
When I use devenv.com,
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.com" "C:\WorkArea\xxxxxx\_work\1\s\xxxxx\Main\Source\xxxxxx.sln" /build "debug"
it has the error:
Is it a known issue or bug of Current Visual Studio 2017 (version 15.2 - 26430.6)? What's wrong with the AssemlyInfo? What's wrong with the TFS build?
You need to restore NuGet packages before attempting the build to resolve references to the reference assemblies that provide you the core types.
You can do this using msbuild /t:Restore (TFS/VSTS: use msbuild task) or nuget.exe restore (use a nuget.exe >= 4.0.0).
There must be some issue within the latest Visual Studio 2017. They, the Microsoft, change the project file structure of .Net Core / standard a lot from 2017 RC to current one.

Building WiX on Visual Studio Team Services times out

I have an existing XAML build I am porting over to Visual Studio Team Services build. There is a Solution file that contains two wixproj projects, and this builds with no issues on the current (legacy XAML) Hosted Build Controller (which uses WiX Toolset v3.7).
In VS TS, I created a new build process and added a step to Build solution using a Visual Studio Build step. I have set the Solution path to my sln that contains the two wixproj projects. All the other options are the defaults except the timeout which is set to 10 minutes.
The build step initiates but times out after calling the Light.exe step, as in the log below:
PrepareForBuild:
Creating directory "obj\Debug\".
Creating directory "bin\Debug\".
Compile:
C:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe -dDebug ...
Windows Installer XML Toolset Compiler version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
{myfile}.wxs
Link:
C:\Program Files (x86)\WiX Toolset v3.10\bin\Light.exe -out ...
Windows Installer XML Toolset Linker version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
##[error]The task has timed out.
The build will run 10 minutes and then throw a timeout error. It usually takes ~1 minute to finish. There is no information in the log about where this may be timing out or why.
I see that VS TS Build uses WiX version 3.10, but WiX version 3.10 works for me locally to build this same sln. I haveve tried all options for Visual Studio Version in the build step with same results.
Any ideas what I am missing and why this isn't working?
I found a post in the wixtoolset GitHub project documenting a bug in WiX 3.10 about deadlocks occurring with WiX projects if there are any warning or error messages generated during the build.
The workaround is to add the following MSBuild Arguments in the build step:
/p:RunWixToolsOutOfProc=true
This resolved my issue with the Light.exe process timing out.
Files (x86)\WiX Toolset v3.10\bin\candle.exe -dDebug ...
Windows Installer XML Toolset Compiler version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
{myfile}.wxs
Link:
C:\Program Files (x86)\WiX Toolset v3.10\bin\Light.exe -out ...
Windows Installer XML Toolset

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.

Non-Concurrent builds using DevEnv.exe

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

Resources