That error doesn't seem to have anything to do with your added code.
UseContentRoot moved from Hosting to Hosting.Abstractions a little while ago. It sounds like your packages are out of sync. Make sure you have the same version of each package. If not, clear your caches and try again.