Fixing errors CS1525 and CS1003 in MSBuild

When building a Microsoft Visual Studio 2017 solution that uses C#6 and C#7 features from the command line (PowerShell), I was getting the errors:

MyClass.cs(845,112): error CS1525: Invalid expression term ‘decimal’ [Web.csproj]
MyClass.cs(845,120): error CS1003: Syntax error, ‘,’ expected [Web.csproj]
MyClass.cs(870,116): error CS1525: Invalid expression term ‘decimal’ [Web.csproj]
MyClass.cs(870,124): error CS1003: Syntax error, ‘,’ expected [Web.csproj]

This was caused by using the wrong version of MSBuild.

I used "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" after switching to

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" the problem was resolved.

Leave a Reply

Your email address will not be published. Required fields are marked *