Skip to content

Commit

Permalink
Fix #2213 - Workaround for TFS dependency resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
drwatson1 committed Mar 31, 2017
1 parent 449853f commit f069200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Paket.Core/NuGetV2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ let getDetailsFromNuGetViaODataFast auth nugetURL (packageName:PackageName) (ver
return parseODataDetails(url,nugetURL,packageName,version,raw)
}

let urlSimilarToTfsOrVsts url =
String.containsIgnoreCase "visualstudio.com" url || (String.containsIgnoreCase "/_packaging/" url && String.containsIgnoreCase "/nuget/v" url)

/// Gets package details from NuGet via OData
let getDetailsFromNuGetViaOData auth nugetURL (packageName:PackageName) (version:SemVerInfo) =
let queryPackagesProtocol (packageName:PackageName) =
Expand Down Expand Up @@ -293,8 +296,9 @@ let getDetailsFromNuGetViaOData auth nugetURL (packageName:PackageName) (version
async {
try
let! result = getDetailsFromNuGetViaODataFast auth nugetURL packageName version
if String.containsIgnoreCase "visualstudio.com" nugetURL && result.Dependencies.IsEmpty then
if urlSimilarToTfsOrVsts nugetURL && result.Dependencies.IsEmpty then
// TODO: There is a bug in VSTS, so we can't trust this protocol. Remvoe when VSTS is fixed
// TODO: TFS has the same bug
return! queryPackagesProtocol packageName
else
return result
Expand Down Expand Up @@ -679,7 +683,7 @@ let rec private getPackageDetails alternativeProjectRoot root force (sources:Pac
match source with
| NuGetV2 nugetSource ->
return! tryV2 source nugetSource
| NuGetV3 nugetSource when nugetSource.Url.Contains("pkgs.visualstudio.com") ->
| NuGetV3 nugetSource when urlSimilarToTfsOrVsts nugetSource.Url ->
match NuGetV3.calculateNuGet2Path nugetSource.Url with
| Some url ->
let nugetSource : NugetSource =
Expand Down
1 change: 1 addition & 0 deletions src/Paket.Core/NuGetV3.fs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let calculateNuGet3Path(nugetUrl:string) =
| "http://www.nuget.org/api/v2" -> Some "http://api.nuget.org/v3/index.json"
| "https://www.nuget.org/api/v2" -> Some "https://api.nuget.org/v3/index.json"
| url when url.EndsWith("/nuget/v2") && url.Contains("pkgs.visualstudio.com") -> Some (url.Replace("/nuget/v2","/nuget/v3/index.json"))
| url when url.EndsWith("/nuget/v2") && url.Contains("/_packaging/") -> Some (url.Replace("/nuget/v2","/nuget/v3/index.json")) // TFS
| url when url.EndsWith("api/v2") && url.Contains("visualstudio.com") -> Some (url.Replace("api/v2","api/v3/index.json"))
| url when url.EndsWith("api/v2") && url.Contains("myget.org") -> Some (url.Replace("api/v2","api/v3/index.json"))
| url when url.EndsWith("v3/index.json") -> Some url
Expand Down

0 comments on commit f069200

Please sign in to comment.