Fixing error MSB4036: The “GetReferenceNearestTargetFrameworkTask” task was not found

When you build a project with MSBUILD Tools 2017 and getting that error, you probably need to update your MSBUILD Tools components.

Download the latest version of MSBUILD tools from, 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.


error CS8107: Feature ‘leading digit separator’ is not available in C# 7.0. Please use language version 7.2 or greater.

You probably need to add <LangVersion>7.2</LangVersion> to your project file(s). Make sure to add it to both debug and release configuration. It’s likely that you will run your server builds on release, so that’s needed.

5 thoughts on “Fixing error MSB4036: The “GetReferenceNearestTargetFrameworkTask” task was not found”

  1. Unfortunately, didn’t help. Even after adding 7.2 to release I still can’t publish Web Application. Interesting note – that Console application doesn’t have this problem!

  2. Didn’t work… My solution builds perfect on my Visual Studio 2017 but on my BuildAgent it always show the “GetReferenceNearestTargetFrameworkTask” task was not found … error. I did install all the tools from vs_build tools… I actually need an offline installer… but that part did work, but did not solve the problem

Leave a Reply

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