Restoring packages wrong version

aspnetman's Avatar

aspnetman

03 Nov, 2020 01:58 PM

Hi!
I'm trying to buuild project with multiple TargetFrameworks:

<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>

I have PackageReference to System.Net.Http Version="4.3.4":

<PackageReference Include="System.Net.Http" Version="4.3.4" />

but when I'm trying to build it on Appveyour I receive error on nuget restore step:

Failed to retrieve information about 'System.Net.Http' from remote source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'. Response status code does not indicate success: 404 (Not Found). Command exited with code 1
Build failed

Why it trying to find version 2.0.0?

Here is my appveyor.yml

configuration: Release

before_build:
 - nuget restore

cache: 
 #- packages

build:
 project: Some.sln
 verbosity: normal
 publish_nuget: true

dotnet_csproj:
  patch: true
  file: '**\*.csproj'
  version: '{version}'
  package_version: '{version}'
  assembly_version: '{version}'
  file_version: '{version}'
  informational_version: '{version}'

nuget:
  account_feed: true
  project_feed: false
  1. Support Staff 1 Posted by Feodor Fitsner on 03 Nov, 2020 07:12 PM

    Feodor Fitsner's Avatar

    Is it AppVeyor Server?

  2. 2 Posted by aspnetman on 03 Nov, 2020 10:35 PM

    aspnetman's Avatar

    AppVeyor Server hosted in machine in my local network with Appveyor.Server service

  3. Support Staff 3 Posted by Feodor Fitsner on 04 Nov, 2020 07:11 PM

    Feodor Fitsner's Avatar

    Check what AppVeyor URL you have on "General" tab of system settings. That URL is used to build NuGet URLs.

  4. 4 Posted by aspnetman on 05 Nov, 2020 10:52 AM

    aspnetman's Avatar

    When my csproj file have this configuration all ok:

    <TargetFramework>netcoreapp3.1</TargetFramework>
      <ItemGroup>
        <PackageReference Include="nlog" Version="4.6.2" />
      </ItemGroup>
    
    here is a part of build log of nuget restore step:

    nuget restore MSBuild auto-detection: using msbuild version '16.4.0.56107' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'.
    Restoring packages for C:\Users\appveyor\projects\utils-http\Source\Utils.Http.csproj...
    Committing restore...
    Generating MSBuild file C:\Users\appveyor\projects\utils-http\Source\obj\Utils.Http.csproj.nuget.g.props.
    Generating MSBuild file C:\Users\appveyor\projects\utils-http\Source\obj\Utils.Http.csproj.nuget.g.targets.
    Writing assets file to disk. Path: C:\Users\appveyor\projects\utils-http\Source\obj\project.assets.json
    Restore completed in 811.61 ms for C:\Users\appveyor\projects\utils-http\Source\Utils.Http.csproj.
    NuGet Config files used:
    C:\Users\appveyor\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used:
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ http://appveyor.theabyss.local/nuget/appveyor-6a5dnn7gbp6e http://localhost:80//nuget/appveyor-6a5dnn7gbp6e http://localhost:80/nuget/utils-patterns-07sfos3sq25j https://api.nuget.org/v3/index.json Running "build" phase

    But I want to convert my project to multiple frameworks supporting: netcoreapp3.1 and net472 .
    I changed my csproj:

    I replaced

    <TargetFramework>netcoreapp3.1</TargetFramework>
    
    with
    <TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
    

    and added PackageReference:

    <PackageReference Include="System.Net.Http" Version="4.3.4" />
    
    after this changes nuget restore step changed:

    nuget restore MSBuild auto-detection: using msbuild version '16.4.0.56107' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'.
    Restoring packages for C:\Users\appveyor\projects\utils-http\Source\Utils.Http.csproj...
    GET http://appveyor.theabyss.local/nuget/appveyor-6a5dnn7gbp6e/FindPack... GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 GET http://localhost/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 73ms Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 404 (Not Found).
    GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 InternalServerError http://localhost/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 140ms NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 11ms Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 404 (Not Found).
    Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 500 (Internal Server Error).
    GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 GET http://localhost/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 21ms Failed to retrieve information about 'System.Net.Http' from remote source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 404 (Not Found). InternalServerError http://localhost/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 54ms Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 500 (Internal Server Error).
    GET http://localhost/nuget/utils-patterns-07sfos3sq25j/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 Command exited with code 1
    Build failed

    please pay attention that MSBuild file is not generated and NuGet Config files are not used and build failed

  5. Support Staff 5 Posted by Feodor Fitsner on 05 Nov, 2020 06:06 PM

    Feodor Fitsner's Avatar

    Remove this section from appveyor.yml and try again:

    nuget:
      account_feed: true
      project_feed: false
    
  6. 6 Posted by aspnetman on 06 Nov, 2020 08:23 AM

    aspnetman's Avatar

    I removed this section but this is not help. Same error.

    What is the easiest/most straightforward way to create a nupkg (nuget package) targeting multiple framework versions? In my case netcoreapp3.1 and net472

  7. Support Staff 7 Posted by Feodor Fitsner on 07 Nov, 2020 05:29 AM

    Feodor Fitsner's Avatar

    From the log I see it's trying to restore from multiple NuGet sources: http://appveyor.theabyss.local, http://localhost:80 and even http://localhost//. Where do you have those sources configured: project level, user level, somewhere else?

    What do you see when running nuget sources?

  8. 8 Posted by aspnetman on 09 Nov, 2020 03:31 PM

    aspnetman's Avatar

    Feodor, Thank you for your answer.
    Yes, the list of nuget sources is strange.

    nuget sources gived me this result:

         1.  nuget.org [Enabled]
          https://api.nuget.org/v3/index.json
         2.  TheAbyss [Enabled]
          http://appveyor.theabyss.local/nuget/appveyor-6a5dnn7gbp6e
         3.  Microsoft Visual Studio Offline Packages [Enabled]
          C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
    

    About NuGet sources: in C:\Users\appveyor\AppData\Roaming\NuGet\NuGet.Config I founded this content:

      <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="TheAbyss" value="http://appveyor.theabyss.local/nuget/appveyor-6a5dnn7gbp6e" />
        <add key="AppveyorAccountFeed" value="http://localhost:80//nuget/appveyor-6a5dnn7gbp6e" />
      </packageSources>
    

    But when I'm tried to remove AppveyorAccountFeed with command

    C:\Users\Administrator>nuget sources Remove -Name AppveyorAccountFeed -Source http://localhost:80//nuget/appveyor-6a5dnn7gbp6e
    
    I received an error: Unable to find any package source(s) matching name: AppveyorAccountFeed.
    I'm tried to remove AppveyorAccountFeed manually from this config, but after new build this record recovered again.

    See new build log below. Please pay attention that nuget.org is not used.

    The configuration of appveyor.yml is same like in my first post in this thread.

    Build log:

    nuget restore
    MSBuild auto-detection: using msbuild version '16.4.0.56107' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'.
    Restoring packages for C:\Users\appveyor\projects\utils-http\Source\Utils.Http.csproj...
    Failed to retrieve information about 'System.Net.Http' from remote source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
      Response status code does not indicate success: 404 (Not Found).
      GET http://appveyor.theabyss.local/nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0
      GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0
      NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 135ms
    Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 404 (Not Found).
      GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0
      NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 21ms
    Retrying 'FindPackagesByIdAsyncCore' for source 'http://localhost:80//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0'.
    Response status code does not indicate success: 404 (Not Found).
      GET http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0
      NotFound http://localhost//nuget/appveyor-6a5dnn7gbp6e/FindPackagesById()?id='System.Net.Http'&semVerLevel=2.0.0 1ms
    Command exited with code 1
    Build failed
    
  9. 9 Posted by aspnetman on 09 Nov, 2020 05:00 PM

    aspnetman's Avatar

    The problem is gone after I edited appveyor.yml and added:

    install:
    - cmd: nuget sources Remove -Name AppveyorAccountFeed -Source http://localhost:80//nuget/appveyor-6a5dnn7gbp6e
    
    nuget source removed ok and build completed.
    Thanks for help.
    By the way why same command in cmd is not removed this nuget source?
  10. Support Staff 10 Posted by Feodor Fitsner on 09 Nov, 2020 05:22 PM

    Feodor Fitsner's Avatar

    Thanks for the update. It's hard to tell why it wasn't deleted in the first place.

  11. Feodor Fitsner closed this discussion on 09 Jan, 2021 09:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac