Weird Issues After Changing C# Code

Hey guys apologies for the newbie behaviour this is my first post.

I have an issue where when I attempt to compile projects that have had their code modified the compilation fails and I get the following error:

“[D:\VSBTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1653,5)]: Error:The “NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask” task could not be loaded from the assembly D:\VSBTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Build.Tasks.dll. Could not load file or assembly ‘Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.”

Ive attempted updating the Visual Studio build tools through the VSUpdater to no avail and i have attempted to reload all the code from source. This problem is only solved when I create a new project from scratch.

It appears to fail after the following compilation steps
[(0,0)]: Debug:Target “ValidateProjects” skipped. Previously built successfully.
[(0,0)]: Debug:Target “GetSolutionConfigurationContents” skipped. Previously built successfully.

and then is followed with this after the error.
[(0,0)]: Debug:Target “_SGenCheckForOutputs” skipped, due to false condition; (’$(_SGenGenerateSerializationAssembliesConfig)’ == ‘On’ or (’@(WebReferenceUrl)’!=’’ and ‘$(_SGenGenerateSerializationAssembliesConfig)’ == ‘Auto’)) was evaluated as (‘Off’ == ‘On’ or (’’!=’’ and ‘Off’ == ‘Auto’)).

I am running Visual Studio Build tools 2019 version 16.2.0

Best Regards and sorry for the long post!