How to find latest version of MsBuild in powershell

Build scripts for .net are always a bit painful, and Microsoft has not made it easy over the years as every release they change the paths. For 2017 it is even worse and it depends on the edition so they want you to use vswhere.exe to locate the installed version(s) of msbuild. I find the following bit of Powershell to be far more portable and reliable. Function Find-MsBuild([int] $MaxVersion = 2017) { $agentPath = "$Env:programfiles (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15....

September 19, 2017 · 2 min · 228 words · Alastair Crabtree

Microsoft.WebApplication.targets was not found (again)

Every time Microsoft releases some build tooling it feels like they forget lots of us use it to build websites. And we do this on build servers that do not have Visual Studio installed using scripts. We even dare to have created websites with old versions of Visual Studio and upgrade them when a new one comes out. I often find that these scripted builds fail on build servers because they are missing Microsoft....

July 28, 2017 · 3 min · 474 words · Alastair Crabtree

How to build a Visual Studio 2013 or 2015 solution on a build server using NAnt

In VS 2013+ msbuild moved out of the core .net framework and is available as a separate install for build agents know as “Build tools”. You need to be aware that MsBuild has moved path for studio 2013 and 2015 - the path of msbuild in 2015 is C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe (moved from C:\Program Files (x86)\MSBuild\12.0\Bin\msbuild.exe in 2013 and C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe in 2012 and before). More info on the studio blog from 2013....

March 22, 2016 · 2 min · 232 words · Alastair Crabtree