public IEnumerable Restore()

in TeamCity.CSharpInteractive/NuGetService.cs [34:76]


    public IEnumerable<NuGetPackage> Restore(NuGetRestoreSettings settings)
    {
        var packagesPath = settings.PackagesPath;
        if (string.IsNullOrWhiteSpace(packagesPath))
        {
            packagesPath = _nugetEnvironment.PackagesPath;
        }

        if (!_fileSystem.IsPathRooted(packagesPath))
        {
            packagesPath = Path.Combine(_environment.GetPath(SpecialFolder.Working), packagesPath);
        }

        settings = settings.WithPackagesPath(packagesPath);
        if (!settings.Sources.Any())
        {
            settings = settings.WithSources(_nugetEnvironment.Sources);
        }

        if (!settings.FallbackFolders.Any())
        {
            settings = settings.WithFallbackFolders(_nugetEnvironment.FallbackFolders);
        }

        var restoreResult = _nugetRestoreService.TryRestore(settings, out var projectAssetsJson);
        if (restoreResult == false)
        {
            _log.Warning($"Cannot restore the NuGet package {settings.PackageId} {settings.VersionRange}".Trim() + '.');
            return Enumerable.Empty<NuGetPackage>();
        }

        var output = Path.GetDirectoryName(projectAssetsJson);
        var outputPathToken = Disposable.Empty;
        if (!string.IsNullOrWhiteSpace(output))
        {
            outputPathToken = _cleaner.Track(output);
        }

        using (outputPathToken)
        {
            return _nugetAssetsReader.ReadPackages(packagesPath, projectAssetsJson);
        }
    }