When you build a project with MSBUILD Tools 2017 and getting “MSB4036: The “GetReferenceNearestTargetFrameworkTask” task was not found” error, you probably need to update your MSBUILD Tools components.
Download the latest version of MSBUILD tools from https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017, run it, choose Modify and then select “Web development build tools” and “.NET Core build tools”.
If you are getting error CS8107: Feature ‘default literal’ is not available in C# 7.0. Please use language version 7.1 or greater.
or
error CS8107: Feature ‘leading digit separator’ is not available in C# 7.0. Please use language version 7.2 or greater.
You need to add <LangVersion>7.2</LangVersion>
to your project file(s). Unless you specifically set up your project, Visual Studio 2017 uses the “C# latest major version (default)” option for C# language, which means you can use only up to C# 7.0:
You can either select C# 7.2 explicitly, or by adding <LangVersion>7.2</LangVersion>
to .csproj file manually.
Note that C# 7.2 is not supported with the vanilla version of Visual Studio 2017. When it was released, Visual Studio 2017 only supports C# 7.0. Supports for C# 7.1, and later, 7.2, were introduced in later updates: 15.3 and 15.4, respectively. At this time of this update, 15.6.1 is available and I personally recommend to upgrade to latest version possible.
Make sure to add it to both debug and release configuration. It’s likely that you will run your server builds on release.