In my case the problem was that I removed a needed .Net package. I solved by opening Visual Studio Installer and checking again the box "Game Development with Unity", doing this it will download again all the missing packages.