Skip to content

Add support for dotnet SDK fallback folder - #3242

Merged
forki merged 1 commit into
fsprojects:masterfrom
csmager:fallback-folder
Jun 8, 2018
Merged

forki merged 1 commit into
fsprojects:masterfrom
csmager:fallback-folder

Conversation

@csmager

@csmager csmager commented Jun 8, 2018 •

Copy link
Copy Markdown
Contributor

The dotnet SDK ships with various .NET Core and ASP.NET Core nuget packages in a NuGetFallbackFolder.

This changes to try to find packages in that folder before looking in other caches or downloading from source. In the event the package is found here, the contents are copied or linked directly from that folder instead of the user's cache.

Paket resolves a few packages with higher versions than the ones that ship, so this doesn't eliminate all downloads, but it makes a very significant dent. A before/after when starting with an empty cache for a project referencing Microsoft.AspNetCore.App:

Before

Performance:
 - Disk IO: 46 seconds
 - Average Download Time: 173 milliseconds
 - Number of downloads: 273
 - Average Request Time: 177 milliseconds
 - Number of Requests: 276
 - Runtime: 1 minute, 6 seconds

After

Performance:
 - Disk IO: 5 seconds
 - Average Download Time: 125 milliseconds
 - Number of downloads: 34
 - Average Request Time: 218 milliseconds
 - Number of Requests: 36
 - Runtime: 12 seconds

We could go further: I'd guess this won't work when e.g. FAKE does a local install of the dotnet SDK as that folder won't be on the path. It seems that there's an MSBuild property available during restore (as I mentioned in #2827 (comment)) that we could pass to paket.exe when called in Paket.Restore.targets.

Fixes #2827

The dotnet SDK ships with various .NET Core and ASP.NET Core nuget
packages in a NuGetFallbackFolder.

This changes to try to find packages in that folder before looking in
other caches or downloading from source. In the event the package is
found here, the contents are copied or linked directly from that folder
instead of the user's cache.
@forki
forki requested a review from matthid June 8, 2018 12:52
DirectoryInfo(Path.Combine(Constants.UserNuGetPackagesFolder,".tools",packageName.CompareString,version.Normalize())).FullName

let TryGetFallbackFolder () =
let dotnet = if isUnix then "dotnet" else "dotnet.exe"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we do it without calling dotnet?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just using it to find the folder, it's not executed. I guess the alternative is to try the default folder depending on platform.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see. that's neat

@forki
forki merged commit a3a94d8 into fsprojects:master Jun 8, 2018
@csmager
csmager deleted the fallback-folder branch June 8, 2018 13:53
@forki forki mentioned this pull request Jun 8, 2018
@inosik inosik mentioned this pull request Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Paket should use preinstalled .NET Core package cache instead of downloading .NET Core framework packages to nuget global cache

2 participants