Getting msbuild.exe without installing Visual Studio - msbuild

How do you get msbuild.exe without installing those crazy Visual Studio programs?
I need it for an npm install to finish working. I'm on Windows 7 and can't get on older version of Visual Studio 2013 Express online.

The latest (as of Jan 2019) stand-alone MSBuild installers can be found here: https://www.visualstudio.com/downloads/
Scroll down to "Tools for Visual Studio 2019" and choose "Build Tools for Visual Studio 2019" (despite the name, it's for users who don't want the full IDE)
See this question for additional information.

It used to be installed with the .NET framework. MsBuild v12.0 (2013) is now bundled as a stand-alone utility and has it's own installer.
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40760
To reference the location of MsBuild.exe from within an MsBuild script, use the default $(MsBuildToolsPath) property.

You can also get the MSBuild executable as a Nuget package https://www.nuget.org/packages/Microsoft.Build.Runtime/.

Download MSBuild with the link from #Nicodemeus answer was OK, yet the installation was broken until I've added these keys into a register:
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\MSBuild\ToolsVersions\12.0]
"VCTargetsPath11"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath11)','$(MSBuildExtensionsPath32)\\Microsoft.Cpp\\v4.0\\V110\\'))"
"VCTargetsPath"="$([MSBuild]::ValueOrDefault('$(VCTargetsPath)','$(MSBuildExtensionsPath32)\\Microsoft.Cpp\\v4.0\\V110\\'))"

Related

TFS build agent cannot find AXImp.exe

TFS build agent using MSBuild 14.0 fails with "Error MSB3091: Task failed because "AxImp.exe" was not found", while the SDK is installed and AxImp.exe is present.
The error states that it cannot find the file in the bin beneath "the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools-x86"
There is no "Microsoft SDKs" node at that location, however it does exist under Wow6432Node: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6.2\
This node contains references to locations for both WinSDK-NetFx40Tools-x86 and WinSDK-NetFx40Tools-x64.
Is MSBuild looking in the wrong registry location?
Can I configure the build to make it locate either
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools
or
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64
to find AxImp.exe and whatever else it expects from the SDK?
Background:
Our development has so far been built on Windows 10, Visual Studio 2017, targeting .Net Framework 4.6.2. I am now trying to automate builds on Windows Server 2012 R2 Standard.
I have installed Microsoft Build Tools 2015, Microsoft .Net Framework 4.6.2 SDK, .Net Framework 4.6.2 Targeting Pack and .Net Framework 4.6.2 Targeting Pack (ENU).
Have successfully created a build agent and get an almost successful build, after chasing down a number of missing dependencies.
TFS build agent cannot find AXImp.exe
(According to the error messages, they are all common errors. we could not give the most direct correct answer for this issue, we can only give you some troubleshootings. In order to avoid losing contact in the round-trip comments, I post those troubleshootings as answer instead of comments.)
Make sure using the MSBuild task instead of Visual Studio build task in the build definition.
Using MSBuild 14.0 (C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe) rather than 4.0 (C:\Windows\Microsoft.NET\Framework\v4.0.30319) in the MSBuild task, if you build the project with Visual Studio 2015.
Check if the ToolsVersion of the Project node is 14.0 not 4.0:
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Install the Visual Studio 2015 on your build server.
Manually change the above registry key to the correct location, where AXImp.exe exists.
If all above not help you, please share the configuration of MSBuild task definition, the software you have installed on the build agent and try to build the project with Visual Studio 2015 on the build server.
Hope this helps.

msbuild fails to compile vsto project

We recently installed a new development environment (Windows 10) from scratch with Visual Studio 2017 but we cannot manage to make msbuild compile a Microsoft Office Addin for Word (vsto).
Within the Visual Studio installer we made sure to include the required components for Office Development.
It throws the following error (german translated to english)
error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found. Also, tried to find "OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" [...]
However, the project builds fine within Visual Studio.
On the old system, everything works fine, and i cannot remember having to configure anything at all.
You need to install Office build tools when installing Build Tools for Visual Studio 2017
In my case, I managed to get around the issue by copying the folder
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio
from the development environment (the old environment in your case) to
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio
on the build environment (the new environment in your case). I would have thought that one should be able to simply get the relevant targets from the Build Tools for Visual Studio 2017 but that appears not to be the case.
After reinstalling everything it works now.
I guess back then when we set up this machine, the build tools setup was bugged or something.
Now we could install everything we needed for the buildtools using the visual studio installer and it works like a charm.
Okay, so I've worked through this one now. The problem was caused by me using Windows\Microsoft.NET\Framework64\v4...\Msbuild.exe.
It looks as though running msbuild from this location results in it not being able to implicitly locate many of the assemblies and build utilities required to build a VSTO project.
I resolved the problem by switching to using C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe

TFS 2015 visual studio build task does not support VS 2017

We have a build definition in TFS 2015 that have worked fine with Visual Studio 2015 projects and solutions. We have now decided to upgrade to Visual Studio 2017 and thus we would like to target Visual Studio 2017 in the Visual Studio build task. We have installed Visual Studio 2017 on the build agent. Unfortunately the only options available int the Visual Studio build task are 2012, 2013, 2015 and Latest. We have tried latest but it does not find Visual Studio 2017 on the build agent. It won't work with the msbuild task either.
I have a similiar issue and resolved by installing VS2017 in my build agent server and configuring MSBuild to point to my MSBuild 15.0 folder:
Add MSBuild to your build steps
On the Advanced options, expand and fill the 'Path to MSBuild' like the image below:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin
VS2017 RTM is released recently while TFS2015 was released before. That's why there is no VS2017 option in VS Build Task in TFS2015 Server. If you upgrade your server to the latest TFS2017, you would see "Visual Studio "15" (preview)" option listed in VS Build Task which is the version for VS2017 preview. And in the feature, the option will be updated to VS2017 which is the same as VSTS.
we are facing a similar issue and it is not possible for us to update ourselves as it is maintained on a company level where we cannot take that much influence.
However our team wanted to switch to VS2017 and make use of the C# 7 features. That's why we tried it as well with replacing the build steps from Visual Studio Build to MSBuild. Sadly this did not work as expected (we got some errors during the build).
As our main objective is to use the C# 7 features we looked for a way how to still achieve that at the time with Visual Studio 2015 remaining on the Build Server. We ended up using the nuget package Microsoft.Net.Compilers that, when used in a project, will use that compiler instead of the installed one.
More on this can be found in this Thread.
It seems the updates to the build tools are installed via the command line of the VS2017 installer.
See the docs for details.
Just adding another thing: if you're using custom build template make sure to edit it and modify the ToolPath attribute value to:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

Visual Studio 2015 Build Tools missing DNX

I've installed Visual Studio 2015 Build Tools onto our TeamCity server but the DNX folder is missing from within its installation root.
MSBuild 14 won't build an xproj because it imports Microsoft.DNX.targets
I've installed the latest DNX via the DNVM but it didn't create the DNX folder I was hoping it would.
The folder is obviously there on my dev box with VS2015 installed. I guess I could install the VS Community Edition, but why would the build tools be missing a crucial component??
Right now the DNX MSBuild targets are only installed with Visual Studio 2015 (specifically the Web Development Tools component).
https://github.com/aspnet/dnx/issues/2207#issuecomment-120076364
So it looks like I'll have to install Visual Studio 2015 Community Edition on the build server.
People are saying I should be using dnu from the command line, but the issue is that I need to make an MSDeploy package, and AFAIK, only MSBuild can do this.
Looks like I need to read this.
http://docs.asp.net/en/latest/publishing/iis.html

Visual Studio 2010 beta 2 and WiX?

Has anybody been using WiX with 2010? I'm not able to get my install projects to work in 2010 and I can't find any info on getting this to work/future plans for support.
Try installing the latest build of WiX 3.5. This is the version that supports VS2010. I don't know if it has been updated for the beta2 release, but there was a new one built 3 days ago.
EDIT: The link above will not work for Visual Studio 2010 post-Beta. For later releases of Visual Studio 2010, use the latest release:
http://wix.sourceforge.net/releases/
and select the latest version.
which version of Wix are you using? last I checked, there was some compatibility issues with wix >=3, votive, and visual studio.
you might have to get a custom build of votive that will load on 2010.
As of October 26, this is what I had to do to get it working:
Download latest of 3.5 http://wix.sourceforge.net/releases/3.5.1023.0/
I snagged Wix35_x64.msi, you grab the other if you run 32bit. I'm not sure what the other (less obvious) files are for (I'm looking at you, ProjectAggregator2).
After installation, Wix projects load (yay!) but don't build (boo) with an error about the path for Candle.EXE being invalid. Apparently, its still looking for "C:\Program Files (x86)\Windows Installer XML v3" on my system.
Created this directory and copied the contents of "C:\Program Files (x86)\Windows Installer XML v35" into it.
Now, apart from some build errors due to changes in some of the $vars, it works.
We added support for Visual Studio 2010 beta 2 in last Friday's build. See http://www.joyofsetup.com/2009/10/30/wix-v3-5-supports-visual-studio-2010-beta-2/.