This issue might occur when building .NET projects via continuous integration in Azure DevOps as well as when building from Visual Studio after upgrading the version of Visual Studio. To fix the error you may need to rebuild the project or add the rebuild in MSBuild command (If you are using MSBuild)
The target “Build” does not exist in the project. (MSB4057)
The target “Package” does not exist in the project. (MSB4057)
There are multiple solutions for this issue as listed below, you can use any of the ones listed below
Solution 1: if it’s Project is not found ,then add a Rebuild to MSBuild as shown below
"msbuild.exe MySolution.sln /t:Project1:Rebuild;Project2:Rebuild;Project3:Rebuild /p:Configuration=Release /p:DebugType=None /p:OutputPath="C:\Users\myuser\Desktop\Build""
Solution 2: Deleting the .vs folder has resolved this issue for the users who were using VS2017 or later
Solution 3: If you are facing this issue in Azure DevOps, use Visual Studio Build instead of MSBuild