In my case, I got this error because of an empty packages.config file.
This caused the NUGET package manager to fail and show the error Root element is missing.
The resolution was to copy over elements from another non-empty file and then change it according to the needs.