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:ProjectsQuickDriveCodeQuickDrive.Mvcobjproject.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
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…