简体   繁体   中英

“Unable to find package Microsoft.NETCore.App.Host.osx-x64” after upgrading to .NET Core 3.0

Today, .NET Core 3.0 was released . It became available as an update in my Visual Studio for Mac, and decided to upgrade an ASP.NET Core project from .NET Core 2.2.3 to .NET Core 3.0. I thought it would be as simple as changing the Target framework in the Project Options:

在此处输入图像描述

and updating NuGet packages, but when trying to build the project I got the following error:

Unable to find package Microsoft.NETCore.App.Host.osx-x64 with version (= 2.2.3)

Cleaning the solution and restarting Visual Studio didn't help; is there somewhere else I have to change the .NET Core version?

It's not part of the default setup, but during the lifetime of the project I had to add a custom RuntimeFrameworkVersion setting in the.csproj file in order to make a specific package/component work. That setting was still pointing to version 2.2.3. AFAIK, there is no option to change this setting in Visual Studio itself, but if you open the project file you should be able to find it quite easily, right at the top of the file:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <RuntimeFrameworkVersion>2.2.3</RuntimeFrameworkVersion>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
    <Version>1.1</Version>
  </PropertyGroup>

Removing the fifth line altogether (as recommended by @MartinUllrich in the comments) or changing it to

<RuntimeFrameworkVersion>3.0.0</RuntimeFrameworkVersion>

solved the problem for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM