fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 520 forks source link

paket restore does not properly populate the NuGet cache #3388

Open yaakov-h opened 5 years ago

yaakov-h commented 5 years ago

Description

My company has build servers that do not have direct outbound internet access. After deploying new build servers with an updated version of the .NET Core SDK, package restore fails.

We have an internal mirror of the gallery using ProGet that we have instructed Paket to use as it's source.

Paket appears to download the NuGet packages into the user's NuGet cache, but NuGet ignores them and forces a fresh download.

Repro steps (1)

This is the scenario as replicated from my actual issue.

  1. Set up two PCs (VMs are OK) with a clean installation of Windows 10 v1803
  2. On PC 1, install the .NET Core SDK v2.1.201
  3. On PC 1, create a netcoreapp2.0 project with paket.dependencies and paket.lock
  4. Copy the project from PC 1 to PC 2
  5. On PC 2, install the .NET Core SDK v2.1.400
  6. On PC 2, run paket restore
  7. On PC 2, note that %USERPROFILE%\.nuget\packages is populated with packages that paket has downloaded
  8. Disconnect PC 2 from the internet
  9. On PC 2, run dotnet restore.

Repro steps (2)

This is a simpler repro that I came across when building the first repro above:

  1. Set up a PC with .NET Core SDK v2.1.201
  2. Create a netcoreapp2.0 project with paket.dependencies and paket.lock
  3. Run paket restore
  4. Run dotnet restore. Observe that it completes successfully.
  5. Clear the cache with dotnet nuget locals all --clear
  6. Run paket restore
  7. Disconnect the PC from the internet
  8. Run dotnet restore

Expected behavior

dotnet restore uses packages from the local cache that paket has prepopulated.

Actual behavior

dotnet fails to build with a NuGet error:

Unable to load the service index for source https://api.nuget.org/v3/index.json

If PC 2 is reconnected to the internet, then it redownloads many if not all dependent packages in their entirety. This can be observed by using Fiddler with SSL/TLS interception enabled.

Known workarounds

Adding a NuGet.config can force NuGet to connect to the proget server and NuGet to download packages.

forki commented 5 years ago

Can you please upload a zip with your repro?

Yaakov notifications@github.com schrieb am Di., 16. Okt. 2018, 02:03:

Description

My company has build servers that do not have direct outbound internet access. After deploying new build servers with an updated version of the .NET Core SDK, package restore fails.

We have an internal mirror of the gallery using ProGet that we have instructed Paket to use as it's source.

Paket appears to download the NuGet packages into the user's NuGet cache, but NuGet ignores them and forces a fresh download. Repro steps (1)

This is the scenario as replicated from my actual issue.

  1. Set up two PCs (VMs are OK) with a clean installation of Windows 10 v1803
  2. On PC 1, install the .NET Core SDK v2.1.201
  3. On PC 1, create a netcoreapp2.0 project with paket.dependencies and paket.lock
  4. Copy the project from PC 1 to PC 2
  5. On PC 2, install the .NET Core SDK v2.1.400
  6. On PC 2, run paket restore
  7. On PC 2, note that %USERPROFILE%.nuget\packages is populated with packages that paket has downloaded
  8. Disconnect PC 2 from the internet
  9. On PC 2, run dotnet restore.

Repro steps (2)

This is a simpler repro that I came across when building the first repro above:

  1. Set up a PC with .NET Core SDK v2.1.201
  2. Create a netcoreapp2.0 project with paket.dependencies and paket.lock
  3. Run paket restore
  4. Run dotnet restore. Observe that it completes successfully.
  5. Clear the cache with dotnet nuget locals all --clear
  6. Run paket restore
  7. Disconnect the PC from the internet
  8. Run dotnet restore

Expected behavior

dotnet restore uses packages from the local cache that paket has prepopulated. Actual behavior

dotnet fails to build with a NuGet error:

Unable to load the service index for source https://api.nuget.org/v3/index.json

If PC 2 is reconnected to the internet, then it redownloads many if not all dependent packages in their entirety. This can be observed by using Fiddler with SSL/TLS interception enabled. Known workarounds

Adding a NuGet.config can force NuGet to connect to the proget server and NuGet to download packages.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3388, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNPbBM-b-vGIDE2U971x39hvTqucoks5ulSJtgaJpZM4XdWKW .

yaakov-h commented 5 years ago

depresolution.zip

zip attached.

You will need to tweak the proget URL in paket.dependencies/paket.lock. Pointing it to the public gallery may be sufficient.

forki commented 5 years ago

It looks that you don't use a paket.references file!?

the following should work:

paket.references:

Microsoft.AspNet.WebApi.Client
Microsoft.NET.Test.Sdk
Moq
NUnit
NUnit3TestAdapter
System.Data.SqlClient

csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netcoreapp2.0</TargetFrameworks>
  </PropertyGroup>
  <Import Project=".paket\Paket.Restore.targets" />
</Project>
yaakov-h commented 5 years ago

I knew I forgot something in the repro.

I’ll try it again tomorrow with that.

Sent from my phone, widescreen iPod, and internet communicator.

On 16 Oct 2018, at 4:50 pm, Steffen Forkmann notifications@github.com wrote:

It looks that you don't use a paket.references file!?

the following should work:

paket.references:

Microsoft.AspNet.WebApi.Client Microsoft.NET.Test.Sdk Moq NUnit NUnit3TestAdapter System.Data.SqlClient csproj:

<?xml version="1.0" encoding="utf-8"?>

netcoreapp2.0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

yaakov-h commented 5 years ago

No luck, exactly the same error when I import Paket.Restore.targets.

edit: forgot to include paket.references. one sec....

depresolution-2.zip

yaakov-h commented 5 years ago

I forgot to include paket.references above.

Here's another one with both Paket.Restore.targets and paket.references

depresolution-3.zip

forki commented 5 years ago

you still have PackageReference in the csproj - please remove these

yaakov-h commented 5 years ago

Fourth time's the charm, I guess.

depresolution-4.zip

This one passes the "simpler" single-machine repro case.

It fails on the multi-machine case, i.e., with a totally emptied NuGet cache:

Passing:

  1. Install .NET Core SDK 2.1.201
  2. Download and extract this ZIP, tweaking the ProGet URL if/where required.
  3. Run .paket\paket.exe restore
  4. Disconnect from the internet
  5. Run dotnet restore

Failing:

  1. Install .NET Core SDK 2.1.400
  2. Download and extract this ZIP, tweaking the ProGet URL if/where required.
  3. Run .paket\paket.exe restore
  4. Disconnect from the internet
  5. Run dotnet restore
forki commented 5 years ago

Ok I'm on 2.1.403 and can't repro. Here is what I did:

at this point only the project's packages are in my cache. Now:

image

and it succeeds

yaakov-h commented 5 years ago

Hmm, yet I can repro perfectly on a totally clean install with 2.1.403.

Can you try this with Hyper-V or any other hypervisor?:

  1. Install Windows 10 Pro x64
  2. Install .NET SDK 2.1.403
  3. Use "dotnet new" in an empty folder to pre-populate the NuGet cache with packages from the SDK
  4. Download and extract the above ZIP file (depresolution-4.zip)
  5. Modify the ProGet URL if applicable. Not applicable here, so I didn't.
  6. Run .paket\paket.exe restore
  7. Disconnect the VM's network adapter
  8. Run dotnet restore

Full command-line output:

``` C:\Users\yaakov\Desktop\depresolution>dotnet --info .NET Core SDK (reflecting any global.json): Version: 2.1.403 Commit: 04e15494b6 Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.403\ Host (useful for support): Version: 2.1.5 Commit: 290303f510 .NET Core SDKs installed: 2.1.403 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download C:\Users\yaakov\Desktop\depresolution>.paket\paket.exe restore Checking Paket version (version 5.173.1 requested)... Version 5.173.1 not found in cache. Starting download from http://proget.wtg.zone/nuget/Gallery//package/Paket/5.173.1 Done in 4.3 second(s). Paket version 5.173.1 Starting full restore process. Downloading Castle.Core 4.3.1 Downloading runtime.native.System.Data.SqlClient.sni 4.5.0 Downloading System.Diagnostics.DiagnosticSource 4.5.1 Download of Castle.Core 4.3.1 done in 10 seconds. (6453 kbit/s, 0 MB) Download of runtime.native.System.Data.SqlClient.sni 4.5.0 done in 10 seconds. (919 kbit/s, 0 MB) Downloading System.Security.Principal.Windows 4.5.1 Downloading Microsoft.CodeCoverage 15.9.0 Download of System.Diagnostics.DiagnosticSource 4.5.1 done in 14 seconds. (322 kbit/s, 0 MB) Downloading System.Diagnostics.TraceSource 4.3.0 Download of System.Diagnostics.TraceSource 4.3.0 done in 317 milliseconds. (19175 kbit/s, 0 MB) Download of Microsoft.CodeCoverage 15.9.0 done in 1 second. (73523 kbit/s, 2 MB) Downloading Microsoft.NET.Test.Sdk 15.9.0 Downloading System.Reflection.TypeExtensions 4.5.1 Download of System.Security.Principal.Windows 4.5.1 done in 7 seconds. (557 kbit/s, 0 MB) Download of Microsoft.NET.Test.Sdk 15.9.0 done in 4 seconds. (629 kbit/s, 0 MB) Download of System.Reflection.TypeExtensions 4.5.1 done in 4 seconds. (11015 kbit/s, 0 MB) Downloading Microsoft.NETCore.Platforms 2.1.1 Download of Microsoft.NETCore.Platforms 2.1.1 done in 742 milliseconds. (1440 kbit/s, 0 MB) Downloading Moq 4.10.0 Download of Moq 4.10.0 done in 847 milliseconds. (28220 kbit/s, 0 MB) Downloading System.Data.Common 4.3.0 Download of System.Data.Common 4.3.0 done in 5 seconds. (30903 kbit/s, 0 MB) Downloading System.Runtime.CompilerServices.Unsafe 4.5.2 Downloading System.Linq.Queryable 4.3.0 Download of System.Runtime.CompilerServices.Unsafe 4.5.2 done in 1 second. (2150 kbit/s, 0 MB) Download of System.Linq.Queryable 4.3.0 done in 1 second. (11754 kbit/s, 0 MB) Downloading NUnit 3.11.0 Download of NUnit 3.11.0 done in 1 second. (48595 kbit/s, 3 MB) Downloading System.Xml.ReaderWriter 4.3.1 Download of System.Xml.ReaderWriter 4.3.1 done in 736 milliseconds. (149236 kbit/s, 1 MB) Downloading NUnit3TestAdapter 3.10.0 Download of NUnit3TestAdapter 3.10.0 done in 679 milliseconds. (9682 kbit/s, 0 MB) Downloading runtime.native.System 4.3.1 Download of runtime.native.System 4.3.1 done in 410 milliseconds. (3264 kbit/s, 0 MB) Performance: - Disk IO: 1 minute, 12 seconds - Average Download Time: 810 milliseconds - Number of downloads: 17 - Average Request Time: 789 milliseconds - Number of Requests: 17 - Runtime: 1 minute, 14 seconds C:\Users\yaakov\Desktop\depresolution>dotnet restore Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No such host is known [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Users\yaakov\Desktop\depresolution> ```

If I then reconnect to the internet but have tcp/80 and tcp/443 firewalled off at the network layer, I get a different but similar error:

C:\Users\yaakov\Desktop\depresolution>dotnet restore
  Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj...
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'.
  No connection could be made because the target machine actively refused it
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'.
  No connection could be made because the target machine actively refused it
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to retrieve information about 'Microsoft.NETCore.App' from remote source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error :   No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]

Then, if in another folder I run dotnet new console && dotnet build, it seems to prepopulate enough information that the error message in the repro project changes:

C:\Users\yaakov\Desktop\depresolution>dotnet restore
  Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj...
  Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'.
  No connection could be made because the target machine actively refused it
  Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'.
  No connection could be made because the target machine actively refused it
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'.
  No connection could be made because the target machine actively refused it
  Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'.
  No connection could be made because the target machine actively refused it
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to retrieve information about 'Microsoft.NETCore.App' from remote source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]
C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error :   No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]

Could it simply be that something else in dependency resolution had effectively locked Microsoft.NETCore.App to 2.0.0 when paket update was run on the older .NET SDK, and Paket isn't downloading it?

If so I'd assume the same issue occurs with NETStandard.Library.

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app only contains version 2.1.0, not 2.0.0, which is indicated by the error message above.

forki commented 5 years ago

did yoo try to add <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> to the property group of your csproj?

forki commented 5 years ago

Ok that's a more of nuget issue. Not really related to paket restore. We can't specify the netcore version. And therefore we need to rely on nuget here

Yaakov notifications@github.com schrieb am Mo., 22. Okt. 2018, 00:46:

Hmm, yet I can repro perfectly on a totally clean install with 2.1.403.

Can you try this with Hyper-V or any other hypervisor?:

  1. Install Windows 10 Pro x64
  2. Install .NET SDK 2.1.403
  3. Use "dotnet new" in an empty folder to pre-populate the NuGet cache with packages from the SDK
  4. Download and extract the above ZIP file (depresolution-4.zip https://github.com/fsprojects/Paket/files/2489612/depresolution-4.zip )
  5. Modify the ProGet URL if applicable. Not applicable here, so I didn't.
  6. Run .paket\paket.exe restore
  7. Disconnect the VM's network adapter
  8. Run dotnet restore

Full command-line output:

C:\Users\yaakov\Desktop\depresolution>dotnet --info .NET Core SDK (reflecting any global.json): Version: 2.1.403 Commit: 04e15494b6

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.403\

Host (useful for support): Version: 2.1.5 Commit: 290303f510

.NET Core SDKs installed: 2.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

C:\Users\yaakov\Desktop\depresolution>.paket\paket.exe restore Checking Paket version (version 5.173.1 requested)... Version 5.173.1 not found in cache. Starting download from http://proget.wtg.zone/nuget/Gallery//package/Paket/5.173.1 Done in 4.3 second(s). Paket version 5.173.1 Starting full restore process. Downloading Castle.Core 4.3.1 Downloading runtime.native.System.Data.SqlClient.sni 4.5.0 Downloading System.Diagnostics.DiagnosticSource 4.5.1 Download of Castle.Core 4.3.1 done in 10 seconds. (6453 kbit/s, 0 MB) Download of runtime.native.System.Data.SqlClient.sni 4.5.0 done in 10 seconds. (919 kbit/s, 0 MB) Downloading System.Security.Principal.Windows 4.5.1 Downloading Microsoft.CodeCoverage 15.9.0 Download of System.Diagnostics.DiagnosticSource 4.5.1 done in 14 seconds. (322 kbit/s, 0 MB) Downloading System.Diagnostics.TraceSource 4.3.0 Download of System.Diagnostics.TraceSource 4.3.0 done in 317 milliseconds. (19175 kbit/s, 0 MB) Download of Microsoft.CodeCoverage 15.9.0 done in 1 second. (73523 kbit/s, 2 MB) Downloading Microsoft.NET.Test.Sdk 15.9.0 Downloading System.Reflection.TypeExtensions 4.5.1 Download of System.Security.Principal.Windows 4.5.1 done in 7 seconds. (557 kbit/s, 0 MB) Download of Microsoft.NET.Test.Sdk 15.9.0 done in 4 seconds. (629 kbit/s, 0 MB) Download of System.Reflection.TypeExtensions 4.5.1 done in 4 seconds. (11015 kbit/s, 0 MB) Downloading Microsoft.NETCore.Platforms 2.1.1 Download of Microsoft.NETCore.Platforms 2.1.1 done in 742 milliseconds. (1440 kbit/s, 0 MB) Downloading Moq 4.10.0 Download of Moq 4.10.0 done in 847 milliseconds. (28220 kbit/s, 0 MB) Downloading System.Data.Common 4.3.0 Download of System.Data.Common 4.3.0 done in 5 seconds. (30903 kbit/s, 0 MB) Downloading System.Runtime.CompilerServices.Unsafe 4.5.2 Downloading System.Linq.Queryable 4.3.0 Download of System.Runtime.CompilerServices.Unsafe 4.5.2 done in 1 second. (2150 kbit/s, 0 MB) Download of System.Linq.Queryable 4.3.0 done in 1 second. (11754 kbit/s, 0 MB) Downloading NUnit 3.11.0 Download of NUnit 3.11.0 done in 1 second. (48595 kbit/s, 3 MB) Downloading System.Xml.ReaderWriter 4.3.1 Download of System.Xml.ReaderWriter 4.3.1 done in 736 milliseconds. (149236 kbit/s, 1 MB) Downloading NUnit3TestAdapter 3.10.0 Download of NUnit3TestAdapter 3.10.0 done in 679 milliseconds. (9682 kbit/s, 0 MB) Downloading runtime.native.System 4.3.1 Download of runtime.native.System 4.3.1 done in 410 milliseconds. (3264 kbit/s, 0 MB) Performance:

  • Disk IO: 1 minute, 12 seconds
  • Average Download Time: 810 milliseconds
  • Number of downloads: 17
  • Average Request Time: 789 milliseconds
  • Number of Requests: 17
  • Runtime: 1 minute, 14 seconds

C:\Users\yaakov\Desktop\depresolution>dotnet restore Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj... C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No such host is known [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]

C:\Users\yaakov\Desktop\depresolution>


If I then reconnect to the internet but have tcp/80 and tcp/443 firewalled off at the network layer, I get a different but similar error:

C:\Users\yaakov\Desktop\depresolution>dotnet restore Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj... Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. No connection could be made because the target machine actively refused it Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. No connection could be made because the target machine actively refused it C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to retrieve information about 'Microsoft.NETCore.App' from remote source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]

Then, if in another folder I run dotnet new console && dotnet build, it seems to prepopulate enough information that the error message in the repro project changes:

C:\Users\yaakov\Desktop\depresolution>dotnet restore Restoring packages for C:\Users\yaakov\Desktop\depresolution\depresolution.csproj... Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'. No connection could be made because the target machine actively refused it Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'. No connection could be made because the target machine actively refused it C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to download package 'Microsoft.NETCore.App.2.0.0' from 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/2.0.0/microsoft.netcore.app.2.0.0.nupkg'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. No connection could be made because the target machine actively refused it Retrying 'FindPackagesByIdAsync' for source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. No connection could be made because the target machine actively refused it C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : Failed to retrieve information about 'Microsoft.NETCore.App' from remote source 'https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json'. [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj] C:\Program Files\dotnet\sdk\2.1.403\NuGet.targets(114,5): error : No connection could be made because the target machine actively refused it [C:\Users\yaakov\Desktop\depresolution\depresolution.csproj]

Could it simply be that something else in dependency resolution had effectively locked Microsoft.NETCore.App to 2.0.0 when paket update was run on the older .NET SDK, and Paket isn't downloading it?

If so I'd assume the same issue occurs with NETStandard.Library.

C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app only contains version 2.1.0, not 2.0.0, which is indicated by the error message above.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3388#issuecomment-431710833, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNCxM9lpYgBEiZDcTlUJfvN4Uehfkks5unPlOgaJpZM4XdWKW .

yaakov-h commented 5 years ago

TargetLatestRuntimePatch doesn't make a difference.

If I add <RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion> then dotnet restore works. This suggests to me that, as the error messages above indicated, it's trying 2.0.0 by default for some reason, which was the default on the PC where the project (and paket.lock) was created, but is not present on the PC where I'm running the restore/build.

(I assume the same would apply to a netstandardX.X project and <NetStandardImplicitPackageVersion>.)

It seems odd that Paket can manage every dependency except the most foundational one.

forki commented 5 years ago

Yes we tried to manage these as well but runtime and build was always complaining. In other words we didn't find a way yet to control this properly

Yaakov notifications@github.com schrieb am Di., 23. Okt. 2018, 00:05:

TargetLatestRuntimePatch doesn't make a difference.

If I add 2.1.0 then dotnet restore works. This suggests to me that, as the error messages above indicated, it's trying 2.0.0 by default for some reason, which was the default on the PC where the project (and paket.lock) was created, but is not present on the PC where I'm running the restore/build.

(I assume the same would apply to a netstandardX.X project and

.) It seems odd that Paket can manage every dependency except the most foundational one. — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or mute the thread .
yaakov-h commented 5 years ago

Hmm, OK. So it seems like, for .NET Standard and .NET Core projects, I need:

Does that sound about right?

forki commented 5 years ago

No you only need paket. You don't control netstandard and netcore with nuget properties anyway, right? If so we could probably find a way to do it from paket. What happens if you run dotnet restore before you remove the internet connection. That should download the missing deps. Right?

Yaakov notifications@github.com schrieb am Di., 23. Okt. 2018, 07:51:

Hmm, OK. So it seems like, for .NET Standard and .NET Core projects, I need:

  • Paket to resolve and download third-party dependencies
  • NuGet itself to resolve and download first-party dependencies ( NetStandard.Library/Microsoft.NetCore.App)
  • NuGet.config to match paket.dependencies when using a NuGet server other than the public gallery (e.g. for a mirror in a firewalled environment)

Does that sound about right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3388#issuecomment-432102334, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNLSLfP1EMj520xItpnDZWmZQ8o71ks5unq5ugaJpZM4XdWKW .

yaakov-h commented 5 years ago

Yes, dotnet restore with an internet connection will download the missing base dependencies.

The base versions seem to be controlled by RuntimeFrameworkVersion/NetStandardImplicitPackageVersion, so in theory Paket.Restore.targets could set that to a predefined version.

However, I'm not currently setting them, so it should just use the SDK's defaults. I don't yet know why the 2.1 SDK is defaulting to 2.0 for a project created on 2.0.

forki commented 5 years ago

If these are the correct properties then I would love to control them by paket. I won't have time to do it myself in next couple of weeks, but if someone wants to try it out - this is something we would very likely accept.

Yaakov notifications@github.com schrieb am Di., 23. Okt. 2018, 08:12:

Yes, dotnet restore with an internet connection will download the missing base dependencies.

The base versions seem to be controlled by RuntimeFrameworkVersion/ NetStandardImplicitPackageVersion, so in theory Paket.Restore.targets could set that to a predefined version.

However, I'm not currently setting them, so it should just use the SDK's defaults. I don't yet know why the 2.1 SDK is defaulting to 2.0 for a project created on 2.0.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3388#issuecomment-432106752, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNKG-6Ku2zVXCWHeCVEWdPhAvsO-Oks5unrM9gaJpZM4XdWKW .

moh-hassan commented 5 years ago

I find that Paket uses nuget cache in that environment:

I checked to use a package not in nuget cache, and when running 'paket install' it uses the the cache folder to install and then to restore.

yaakov-h commented 5 years ago

Correct, but as discussed above, Paket does not appears to restore the (correct) SDK implicit packages.

moh-hassan commented 5 years ago

Can you run:

          .paket\paket.exe restore -v

to know what is going on, what is installed from cache and what is downloaded from internet.

I used your depresolution-4.zip Paket is copying all packages (with the transitive dependency) from cache to the local folder packages. (I disabled the network card and run fiddler, and no access to the internet )

The issue here, is that paket creates a local folder "packages", and it shouldn't, because the value of PackageReference is dealing with the cache only if package exist (no creating extra storage) although i usedstorage: none

I think that paket should avoid creating pakage folder to avoid consuming extra storage

forki commented 5 years ago

Are we now talking about a different issue? If so then please open a separate ticket.

Am Mo., 12. Nov. 2018, 03:21 hat Mohamed Hassan notifications@github.com geschrieben:

Can you run:

      .paket\paket.exe restore -v

to know what is going on, what is installed from cache and what is downloaded from internet.

I used your depresolution-4.zip Paket is copying all packages (with the transitive dependency) from cache to the local folder packages. (I disabled the network card and run fiddler, and no access to the internet )

The issue here, is that paket creates a local folder "packages", and it shouldn't, because the value of PackageReference is dealing with the cache only if package exist (no creating extra storage) although i used storage: none

I think that paket should avoid creating pakage folder to avoid consuming extra storage

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fsprojects/Paket/issues/3388#issuecomment-437732197, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNDfz35oeqN7drQBKUdwENxJ72P1vks5uuNs-gaJpZM4XdWKW .