Unable to find package Microsoft.NETCore.App.Host.win-x64 with version (= 2.2.7) after upgrading to NetCore 3.1
Asked Answered
S

3

14

I update nuget packages from 2.2.x to 3.1.0 on my local feed. Then, out build machine try to build projects, but:

Project.csproj(0,0): Error NU1102: Unable to find package Microsoft.NETCore.App.Host.win-x64 with version (= 2.2.7)
- Found 1 version(s) in localfeed [ Nearest version: 3.1.0 ]

nuget.org link says that i should not use it directly. So i am not using it directry.

Example of csproj:

  <Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Label="Globals">
 <SccProjectName>SAK</SccProjectName>
 <SccProvider>SAK</SccProvider>
 <SccAuxPath>SAK</SccAuxPath>
 <SccLocalPath>SAK</SccLocalPath>
 </PropertyGroup>

  <PropertyGroup>
<ProjectGuid>{9B42C5B4-188E-482F-BC44-C3B243F92848}</ProjectGuid>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<PackageId>Project</PackageId>   
<AssemblyName>Projectr</AssemblyName>
<Version>1.1.0</Version>

Why .net core can not use Microsoft.NETCore.App.Host.win-x64 3.1.0 version?

Symbolize answered 13/1, 2020 at 13:15 Comment(7)
Is that your entire .csproj file? Your error message is quite specific on the version, indicating that something is requiring v2.2.7, perhaps another project in your solution? Since 2.2.7 is meant for dontnet 2.x, compatibility issues are also a prime suspect. Also, these are internal packages not recommended for direct consumption, it might help to totally remove the package reference.Ramiform
I agree with @gerryc.inc, also other nuget references could pull old Microsoft.NETCore.App.Host.Aquarium
@gerryc.inc, one of the dependencies project use netstandard2.0. may be this is the point?Symbolize
Bingo!! you need to update that one as wellRamiform
@gerryc.inc, problem was on msbuild config (targeting build task on 2.2.7). changing on 3.1.0 solve problemSymbolize
Okay, so you had no explicit reference of the package after all?Ramiform
@gerryc.inc, no. i try to find this reference from all my csproj files (more than 500 files) and nothing found.Symbolize
S
2

Problem was on msbuild config of this build task (targeting build task on 2.2.7). changing on 3.1.0 solve problem

Symbolize answered 17/1, 2020 at 8:18 Comment(5)
How do we change this?Rattish
you can change it on msbuild build agent settingsSymbolize
@AdmiralLand could you explain this better in the solution so that others can also use it?Fieldfare
I agree with @ToreØstergaard. Because I tried to setup a specific task to use dotnet core 3.1 in my yaml, didn't work. I tried the solution from mike, didn't work too. And your solution is not obvious as you seem to think. Could you please clarify how should we do that ? I went to Project Settings > Agent Pools >Select the pool > Agent Tab > Select my Agent but there is nothing thereJeuz
Unclear answer.Hornbill
B
11

In .csproj file of our application we have RuntimeFrameworkVersion. There we update it to desired version :

<PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeFrameworkVersion>3.1.0</RuntimeFrameworkVersion>
</PropertyGroup>
Bench answered 15/9, 2020 at 12:38 Comment(2)
The package, Microsoft.NETCore.App.Host.win-x64, needed to be in my nuget feed with the correct version visualstudio 2022 to build and run the dotnet core project. It may have been locally cached in Visual Studio 2019 and upgrading the Visual Studio 2022 didn't pick up the cached package. I targeted the public nuget feed instead of our private one to verify and it fixed the issue.Primo
@Bench how do I find the desired version? I am getting this error after adding all RunTimeIdentifiers in project settings in net core 6 console app. I am getting this error for rhel.6-x64Brusque
S
2

Problem was on msbuild config of this build task (targeting build task on 2.2.7). changing on 3.1.0 solve problem

Symbolize answered 17/1, 2020 at 8:18 Comment(5)
How do we change this?Rattish
you can change it on msbuild build agent settingsSymbolize
@AdmiralLand could you explain this better in the solution so that others can also use it?Fieldfare
I agree with @ToreØstergaard. Because I tried to setup a specific task to use dotnet core 3.1 in my yaml, didn't work. I tried the solution from mike, didn't work too. And your solution is not obvious as you seem to think. Could you please clarify how should we do that ? I went to Project Settings > Agent Pools >Select the pool > Agent Tab > Select my Agent but there is nothing thereJeuz
Unclear answer.Hornbill
T
0

Update visual studio to latest version worked for me :-)

Translation answered 18/5, 2022 at 10:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.