Fixing MSBuild CS1525, CS1003 Compiler Errors

· 1 min

I recently needed MSBuild to compile a solution on a build server, using the MSBuild in:

C:\Program Files (x86)\MSBuild\14.0\Bin

It had worked before, but now failed with these errors:

error CS1525: Invalid expression term 'decimal'
Syntax error, ',' expected
error CS1003: Syntax error, ',' expected [Web.csproj]

The code used C# 6 and 7 features that this version of MSBuild doesn't support.

The fix

Use the newer MSBuild that ships with Visual Studio 2017:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin