2

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:

enter image description here

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?

Glorfindel
  • 21,988
  • 13
  • 81
  • 109

1 Answers1

6

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
  • Take a look at the presentation on porting .net applications to .net core 3.0, from yesterdays .net conference: https://www.youtube.com/watch?v=k7z4ZxFc8h8 Some useful tools presented... – Vladimir Sep 24 '19 at 07:30
  • If you don't explicitly need to target a specific version, I recommend removing this line altogether. it may cause you to miss important security patches if you do self-contained deployments. – Martin Ullrich Sep 24 '19 at 08:52