The same msbulid.exe shows different version on different machines - visual-studio

I am trying to replicate my development environment into my build server in order to debug an error that occurs only in the build server, The same solution is compiled with msbuild that is located in C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe in both machines.
In the development machine, the solution is getting compiled successfully while in the build server it fails.
Reading the outputs from msbuild I noticed that in both machines the build is done with different versions of Microsoft build engine
dev machine: 14.0.25420.1
build server:14.0.23107.0
In order to rule out that this error relates to the version
I tried to pass the msbuild from the dev machine to the build server and ran it there which output the build server version.
How can the same msbuild yield different version on a different machine?
How can I update the build engine?

How can the same msbuild yield different version on a different machine?
According to the official blog MSBuild is now part of Visual Studio!:
Starting with Visual Studio 2013, the 2013 version of MSBuild will
ship as a part of Visual Studio instead of the .NET Framework.
So at this moment, MSBuild.exe have the same version of Visual Studio 2015, you can check the version of Visual Studio 2015:
So update the version of Visual Studio on the build server to have the same version MSBuild.exe.
Update for comment:
Is it possible to update msbuild without installing visual studio?
The answer is yes, you can download the Microsoft Build Tools 2015, install it to update msbuild.exe without installing Visual Studio.
Please refer to the document MSBuild is now part of Visual Studio! for details:
The New Microsoft® Build Tools Package
MSBuild is now a component of Visual Studio and will ship with all
SKUs of Visual Studio, including Team Build so if you use Visual
Studio all of your build needs should be covered. We understand that
there are a great number of reasons that you may want to use MSBuild
and other build tools without needing to install Visual Studio so we
are making the tools available as a new standalone package called
Microsoft® Build Tools. The package includes MSBuild and the VB/C#
compilers. The new package can be acquired here on the MSDN Download
Center.
This standalone package is great for build servers requiring fine
grain control of their build process. With this new approach to
evolving MSBuild, you have more control over build behavior and are
not impacted by .NET Framework versions.
Hope this helps.

Related

Question - Why TFS is taking Msbuild 10.0 Instead of Version 14.0? [duplicate]

My project need to be run with MSbuild 14.0(visual studio 2015) but this is taking only Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe .
I have installed visual studio community 2017,VS 2015 web and Desktop express on my Build Agent.
Capabilities of build agent-
Task Configuration -
This configuration giving me the warning -
[warning]Visual Studio version '14.0' not found. Falling back to version '15.0'.
How can I use MSBuild 14.0 with Visual Studio build task .?? This is running with MSbuild task..
Thanks in Advance ..!!
[warning]Visual Studio version '14.0' not found. Falling back to version '15.0'
Since I do not install Visual Studio 2015 Express for Desktop and Web on my build agent, I am not sure whether Visual Studio 2015 Express for Desktop and Web is compatible with build agent.
But I found a thread about it, you can check the comment on the accepted answer:
That's it! For some reason VS2015 Express does not install the ShellFolder or InstallDir keys! I was worried that the agent script recognised it but refused to register it because we are not allowed to use it for automated builds. I feel more comfortable with it now.
It turns out that is not the full story. When I add the "Visual Studio
Build" task to the process, it now executes, but if I look more
closely at the log, I can see the following message:
"##[warning]Visual Studio was not found. Try installing a supported
version of Visual Studio. See the task definition for a list of
supported versions." And then it falls back to building with MSBuild.
It works because I am building a .sln; let's just hope I don't have to
build a .proj.
So, it seems that Visual Studio 2015 Express is not compatible with build agent. you can try to install the Visual Studio community 2015 instead of it, which I can build it without any issue.
Again, you can check if there is a parameter about Visual Studio on your Capabilities of build agent when you use Visual Studio 2015 Express:
if not, build agent will throw that error.
Hope this helps.

TeamCity Visual Studio Build Runner Requirement

We're running TeamCity 9.0.3 and have had Visual Studio 2010, 2012 & 2013 full install on our build server for years now.
I know for a fact that we need certain Visual Studio targets in order to deploy our applications but I'm convinced we don't need to have a full Visual Studio installation in order to use the Visual Studio (sln) build runner but can't find any documentation to say whether or not we do need it.
Can anyone show me documentation or verify from their own experience whether or not a full Visual Studio install is needed for this build runner to work?
Edit: I have seen this question:
Does MSbuild require Visual Studio to be installed on the build server?
And mine is not the same question, it's a different topic. That question is asking whether or not Visual Studio is needed to as a prerequisite for the MSBuild build runner. My question pertains to the Visual Studio build runner
Roughly speaking, by installing Windows SDKs you get what's required to build applications.
Windows 7 SDK
Windows 8.1 SDK
Windows 10 SDK
Multi targeting packs are also required if you use that.
Starting from Visual Studio 2013, you also need to install the separate MSBuild 2013. And MSBuild 2015.
C++ might require you to install other bits.
So you will have to go through lots of trials. Most people simply give up and install full VS.
You don't need full Visual Studio Installed for running the build, all you need are the build tools.
In the "Step" you create to build your solution, the dropdown allows you to select which version of Microsoft builds you want to use where you can specify whether you use MSBuild12 or the latest MSBuild14 for VS2015 projects.
All you have to do is make sure that you install the required Microsoft Build tools in this instance:
Build tools for 2010, 2012 and 2013. The TC build step should then try detecting this install by default in C:/Program Files (x86)/MS Build/Build Tool Number/MSBuild.exe
Note: You will have to restart your agent after you install these tools on the Agent Machine for TeamCity to detect the tools.
The Visual Studio (sln) build runner requires the proper version of Microsoft Visual Studio installed on the build agent.
Reference: https://confluence.jetbrains.com/pages/viewpage.action?pageId=74847254

How can I get the latest version of Microsoft Build Tools 2013 onto my build server?

MSBuild is now provided with Visual Studio and its versioning is aligned with Visual Studio. It is also provided as a standalone installer (Microsoft Build Tools 2013) as seen here: http://www.visualstudio.com/en-us/downloads
Due to a bugfix that Microsoft put out in Visual Studio 2013 Update 3, I am trying to find the equivalent build of MSBuild to install on the build server. The version of MSBuild referenced in the download link above is 12.0.21005.1, which equates to the initial version of VS2013.
I can't find anywhere with a version of the Microsoft Build Tools 2013 installer that has been built after Update 3 was released. The VS2013 Update 3 build number is 12.0.30723.0.
Does anyone know where to find this? Or is there an alternative method of copying an updated version of MSBuild from my dev machine (which has VS2013 Update 3) to the build server?
I do not want to install Visual Studio in full on the build server.
Extra Information
The reason I need VS2013 update 3 build tasks is because the SignFile task was updated to take a targetframeworkversion parameter which gets around a bug with signing ClickOnce apps. See http://msdn.microsoft.com/en-us/library/ms164304.aspx.
Here is one later version:
https://chocolatey.org/packages/microsoft-build-tools/12.0.21005.20140416
Microsoft Build Tools 2013 12.0.21005.20140416

MSBuild calling the Package Target of Web Project

Does anyone know the components that need to be installed in order to make the Package Target available via MSBuild.
It's possible to Package using MSBuild on a machine with Visual Studio installed, but not on a build server with only the .NET 4 SDK and Web Deploy 2.0 installed, which results in the following error:
msbuild "Package" does not exist in the project.
It partly comes down to the following missing files on the server:
c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\*.*
This can of course be resolved by copying the contents of the MSBuild VisualStudio folder to the equivalent directory on the build server, but this is not a manageable solution for server configuration.
All the answers I've read involve having Visual Studio installed or copying the files. Surely it's possible to compile the Web Deploy package without installing Visual Studio?
I have a TeamCity CI server without VS installed building a Web Project configured to also create a deployment package on successful build. However, for the life of me I can't recall if I copied those files manually or if they were installed by some component.
The relevant components I have installed are the following, if you want to give it a shot:
.NET 4.0 SDK;
Microsoft Visual Studio 2010 Shell (Integrated) Redistributable Package;
Visual Studio 2010 SDK; (Not the VS 2010 SDK SP1)
Microsoft Visual Studio 2010 Visualization & Modeling SDK;
Web Deploy 2.0;
I installed the VS Shell in order to be able to install the VS 2010 SDK which in turn was required in order to install the Visualization & Modeling SDK so that I was able to run T4 transformations on the build server.
With this components and configuring the following MSBuild properties DeployOnBuild=true;DeployTarget=Package to create the deploy package I had no problems, but as I said earlier I may have copied the files manually after giving up all hope of finding a more cleaner solution and now my brain is blocking any memory of such ill action.

How teamcity builds project and requirements of msdeploy on client machine

Just want to know whether msbuild is built in teamcity or teamcity uses the installed msbuild.exe on your build machine. I have no visual studio installed on my build machine. Little bit confused as where to locate msbuild.exe on machine if no visual studio installed.
Also requirements of msdeploy on client machine. Plz clarify.
TeamCity does not provide the compilers for any language, just the integration support to bring those tools together. For MSBuild specifically, you'll need the .NET framework installed, or Visual Studio:
MSBuild ships as part of the .NET Framework, starting with v2.0 in Visual Studio 2005 and updated in v3.5 with Visual Studio 2008.
Alternatively, you can make use of the Mono support that TeamCity provides to go down that road.

Resources