C# – Could not resolve mscorlib for target framework ‘.NETFramework,Version=v4.6.1’

cmscorlibservice-referencevisual studiovisual-studio-2017

When I'm trying to update or configure service reference in .NET 4.6.1 project, VS throws next error:

Could not resolve mscorlib for target framework '.NETFramework,Version=v4.6.1'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.

Path lenght is OK, I'd also checked another answers on SO and nothing works.
Maybe someone has something like that?

Best Answer

I get the same error on VS2019.
This error occurred because I never restored nuget packages and built the solution.

After a restore of nuget packages and a full rebuild of the solution the error disappeared!