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

10,684

Solution 1

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

Solution 2

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>
Share:
10,684

Related videos on Youtube

Admiral Land
Author by

Admiral Land

Updated on June 04, 2022

Comments

  • Admiral Land
    Admiral Land almost 2 years

    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?

    • Gerald Chifanzwa
      Gerald Chifanzwa over 4 years
      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.
    • Lukasz Szczygielek
      Lukasz Szczygielek over 4 years
      I agree with @gerryc.inc, also other nuget references could pull old Microsoft.NETCore.App.Host.
    • Gerald Chifanzwa
      Gerald Chifanzwa over 4 years
      Bingo!! you need to update that one as well
    • Admiral Land
      Admiral Land
      @gerryc.inc, no. i try to find this reference from all my csproj files (more than 500 files) and nothing found.
    • Gerald Chifanzwa
      Gerald Chifanzwa
      Okay, so you had no explicit reference of the package after all?
  • Mohamad Mousheimish
    Mohamad Mousheimish about 4 years
    How do we change this?
  • Admiral Land
    Admiral Land about 4 years
    you can change it on msbuild build agent settings
  • Tore Østergaard
    Tore Østergaard over 2 years
    @AdmiralLand could you explain this better in the solution so that others can also use it?
  • smurtagh
    smurtagh over 2 years
    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.
  • Mister Q
    Mister Q over 2 years
    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 there