How to Install Msbuild.exe 14.0 and Build Project Without Installing Visual Studio?

Before I share how to install and use MS BUILD 14 without installing Visual Studio(VS) let me describe the reason why I needed it. The build server uses ms  build 14  and on my local machine VS 2019 uses  ms build 15 . And I run in a problem after I did some nuget package update. It builds successfully on my local machine but when I pushed my code to the build server the next error occurred:  Multiple assemblies with equivalent identity have been imported: C:\somepath\libname.dll Remove one of the duplicate references.  Looks like MS BUILD 14 can’t resolve duplicate lib reference.
Thus, I needed to fix ambiguous library references and test the build locally. For this, I needed to MS Build 14 which is absent if you have a VS2019 only. To fix this problem check my next steps:

  1. Download MS Build 14
  2. Install MS Build Tools 15 (MSBuild 14.0)
  3. Optional step – Download Microsoft.WebApplication.targets
  4. Build with MSBuild.exe

1. Download MS Build 14

MS Build 14 is a part of Microsoft Build Tools 2015. You can download it here.
ms build tools 15 install download page

Pic 1 – Microsoft Build Tools 15 – Download Page

2. Install MS Build Tools 15 (MSBuild 14.0)

The installation process is pretty simple. Just run BuildTools_Full.exe and click Install.
ms build tools 15 install

Pic 2 – Microsoft Build Tools 15 – Install

After the installation you should notice the next folder:
MS Build Tools 15 Folder Path
 C:\Program Files (x86)\MSBuild\14.0\Bin 

3. Optional step – Download Microsoft.WebApplication.targets

After MS Build Tools was installed I tried to build my Web API project. But I received the next error: The imported project  “C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14 .0\WebApplications\Microsoft.WebApplication.targets” was not found.  Confirm that the path in the declaration is correct and that the file exists on disk.
So I needed to download MSBuild.Microsoft.VisualStudio.Web.targets. After I renamed to ZIP and extract files. And according to message error copied files into appropriate folder. Here how it looks on my machine:
MSBuild.Microsoft.VisualStudio.Web.targets unpack

Pic 3 – Microsoft.WebApplication.targets unbox

4. Build with MSBuild.exe

CMD:  C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\MSBuild.exe D:\myProject\myProj1.sln /property:Configuration=Release  msbuild 15 build

Pic 4 – Build with MSBuild.exe

BTW, I used FAR manage to navigate. For me, it is a bit easy than a regular CMD line.

Leave a Comment