Had a lot of trouble with this (literal days of compiling)… After solving the Nuget problems etc and installing a different SDK, it still didn’t work, getting the same errors as above^… I was using I think a ‘too modern’ sdk. not sure…
Make sure to uninstall old SDKs and that you are using an appropriate windows 10 sdk. Then, in solution explorer in visual studio rightclick and select retarget solution, this should show you’ve selected the right sdk from the visual studio installer. Good luck! I Hope I save you some pain :(.