I have an MVC Core application where the target framework was .NET Core 2.0
. It built, ran, and published perfectly. Then I installed the Core SDK 2.1 and upgraded the target framework to .NET Core 2.1
. Now the app still builds fine, but when I try and publish it, I get the following error:
Assets file 'C:\Projects\QuickDrive\Code\QuickDrive.Mvc\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0'. Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project.
I have tried deleting project.assets.json
but the publish still fails. What is wrong here, and what can I do to resolve this and get my app published? Why is VS looking for "a target for '.NETCoreApp,Version=v2.0'" when I've set the target framework to 2.1?
I am using VS 2017 v15.6.6 and have also tried an often recommended dotnet restore
.
This doesn't explain the cause of the error, and even though this question seems so disliked, I'm posting what solved my problem in case anyone else experiences the same thing, and the same solution works for them.
A simple but huge VS2017 upgrade from v15.6.6 to v15.7.3 solved the problem.