0
votes

I have setup a NuGet Package feed in TFS 2017 Update 1. The NuGet Source is as following

http://tfsserver:8080/tfs/defaultcollection/_packaging/NuGet-Feed/nuget/v3/index.json

Following the instructions stated when connecting to TFS Package Feed, I added NuGet source locally and also try to publish package(s) to the NuGet Feed with following format as an example:

nuget.exe  push -Source "NuGet-Feed" -ApiKey INCTX Microsoft.AspNetCore.Http.Abstractions.1.1.2.nupkg

The result of executing above command is as following:

Pushing Microsoft.AspNetCore.Http.Abstractions.1.1.2.nupkg to 'http://tfsserver:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nug
et/v2/'...
  PUT http://mtrlpqdc2av-053:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nuget/v2/
  Accepted http://mtrlpqdc2av-053:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nuget/v2/ 1702ms
Your package was pushed.

As it shows, the package is published to 'nuget/v2' endpoint.

Running TFS Build with NuGet Restore task: the following command expects nuget/V3/ endpoint from the TFS Feed which does not exists. Note: NuGet restore task in TFS build is customized to use NuGet 4.. version.

GET http://tfsserver:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nuget/v3/flat2/microsoft.aspnetcore.http.abstractions/1.1.2/microsoft.aspnetcore.http.abstractions.1.1.2.nupkg

The question I guess is why NuGet Push will publish to 'nuget/v2/' endpoint.

TFS Build NuGet Restore Task output:

2017-07-06T15:58:13.0657118Z CredentialProvider.TeamBuild: URI: http://tfsserver:8080/tfs/defaultcollection/_packaging/INCTX-NuGet-Feed/nuget/v3/index.json

2017-07-06T15:58:13.0657118Z CredentialProvider.TeamBuild: Is retry: False

2017-07-06T15:58:13.0657118Z CredentialProvider.TeamBuild: Matched prefix:

2017-07-06T15:58:13.2688422Z CredentialProvider.TeamBuild: This provider only handles URIs from the build's Team Project Collection

2017-07-06T15:58:13.6125991Z GET tfsserver:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nuget/v3/flat2/microsoft.netcore.app/index.json

2017-07-06T15:58:13.6125991Z GET tfsserver:8080/tfs/DefaultCollection/_packaging/23093bd8-41aa-403d-9d3f-5c713b14ce32/nuget/v3/flat2/microsoft.netcore.app/index.json

2017-07-06T15:58:13.7219799Z NotFound

Thanks,

Mamrez

2
What's the detail error message? The address is correct, you can go to your feed page, then select that package and check the details of Install [package] section.starian chen-MSFT
I event used NuGet 4.* version. The package push, publishes to nuget/v2 endpoint, I don't know why?. TFS Build NuGet Restore task, is running the 'GET' command as I stated and is looking for nuget/v3. In the feed page, selecting the package also refers to nuget/v3 endpoints. The push does a PUT to nuget/v2 as I mentioned and I don't know why I does that. Updated the question with more results from TFS build task.Mamrez
I used NuGet 4.0 and the push endpoint is nugget/v2, the restore endpoint is nugget/v3, but it works fine for me. Could you install package through Nuget.exe? What's the source URL? Try to create a new package and push to feed, then try it with this package.starian chen-MSFT
You can share a package on the OneDrive.starian chen-MSFT
I can install the package through with NuGet 4.0 on my laptop with the nuget/v3 restore endpoint. but the TFS NuGet Restore task goes Not Found with nuget/v3 endpoint, that's odd. I use NuGet 4.0 in the NuGet Build restore task, which I put the NuGet 4.0 on the build controller.Mamrez

2 Answers

0
votes

You may want to check your nuget.config and reference the following:

https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference#push

it says you can either specify it on push or define DefaultPushSource in the config. I might suspect your v2 source is defined as DefaultPushSource in the config.

try: nuget.exe config DefaultPushSource to see what it is set to.

0
votes

Running on the TFS App-Tier through command line also issued an error which stated the NuGet source couldn't be reached.

Finally figured out that which NuGet.config file was being used and as the result, the NuGet publish from TFS start working both on App Tier and in the TFS build.