When I try to publish my application to the web server after upgrading to .NET Core 2.1 from 2.0, I get this message: \"This version of Microsoft.AspNetCore.All is only compatib
What helped me is just deleting the .pubxml file(s) under the Properties > PublishProfiles folder and then recreating the publish profile again.
To follow on from joakimja's post, you can also update the .pubxml file via the VS2017 IDE. Right click on your project and select "publish" and then click "configure" on the "trouble shooting info" row, then go to the "settings" tab, here you can set the "Target Framework" - in fact this should have automatically updated to "netcoreapp2.1" just by opening the dialog. Click "Save" and this will update the target framework in the pubxml file. Then try publishing again.
I ran into the same problem (error) when trying to deploy my upgraded solution to AWS Lambda using:
dotnet lambda deploy-serverless
It turned out that I'd forgotten to update my aws-lambda-tools-defaults.json file.
"framework" : "netcoreapp2.1",
Adding for others in the same situation.