diff --git a/src/Paket.Core/NugetConvert.fs b/src/Paket.Core/NugetConvert.fs index 83857b76db..a94a22a34e 100644 --- a/src/Paket.Core/NugetConvert.fs +++ b/src/Paket.Core/NugetConvert.fs @@ -251,8 +251,10 @@ let createDependenciesFileR (rootDirectory : DirectoryInfo) nugetEnv mode = if nugetEnv.NugetConfig.PackageSources = [] then [Constants.DefaultNugetStream,None] else nugetEnv.NugetConfig.PackageSources |> List.map (fun (n, auth) -> n, auth |> Option.map (CredsMigrationMode.toAuthentication mode n)) |> List.map (fun source -> - try source |> PackageSource.Parse |> Rop.succeed - with _ -> source |> fst |> PackageSourceParseError |> Rop.fail) + try source |> PackageSource.Parse |> succeed + with _ -> source |> fst |> PackageSourceParseError |> fail + |> successTee PackageSource.warnIfNoConnection) + |> Rop.collect sources diff --git a/src/Paket.Core/PackageSources.fs b/src/Paket.Core/PackageSources.fs index 80777475ae..7fb194d34b 100644 --- a/src/Paket.Core/PackageSources.fs +++ b/src/Paket.Core/PackageSources.fs @@ -1,8 +1,11 @@ module Paket.PackageSources open System +open System.IO open System.Text.RegularExpressions -open Logging + +open Paket.Logging +open Paket.Rop type EnvironmentVariable = { Variable : string @@ -91,4 +94,15 @@ type PackageSource = static member NugetSource url = Nuget { Url = url; Authentication = None } + static member warnIfNoConnection (source,_) = + match source with + | Nuget {Url = url; Authentication = auth} -> + use client = Utils.createWebClient (auth |> Option.map toBasicAuth) + try client.DownloadData url |> ignore + with _ -> + traceWarnfn "Unable to ping remote Nuget feed: %s." url + | LocalNuget path -> + if not <| File.Exists path then + traceWarnfn "Local Nuget feed doesn't exist: %s." path + let DefaultNugetSource = PackageSource.NugetSource Constants.DefaultNugetStream \ No newline at end of file