VSO NuGet Build Build Error

I am using Visual Studio Online - viewing the package manager along with the new build system. A preview of the package manager adds several build steps, including the “NuGet Publisher” step, which should push the packages to a private channel hosted in Visual Studio Online.

Now the documentation here is a bit lower). Like auth documentation and personal access sheets . There are some indications that you do not need authorization between VSO and the package manager if you have permissions set (the build account has permissions for the service endpoint and for extension of the package manager). In the actual build step, you are prompted to select a service from the list of endpoints, so I tried to do this.

When I do not add credentials to the service endpoint, I get an error message:

Server Key must be set, set the password on the generic service 

When I try to put the API key in the service endpoint, it seems to be discarded when saved ... and the error will change to:

 2015-11-18T08:35:24.5678951Z Invoking nuget with push C:\a\1\s\EventViewer\bin\Release\Project.Name.1.1.12.0.nupkg -s https://example.pkgs.visualstudio.com/DefaultCollection/_packaging/example/nuget/v3/index.json usfusmx4ez6mlfqwpp2abzc7e37denfcp7bxsep2hqij3tp4qwvq on C:\a\1\s\EventViewer\bin\Release\Project.Name.1.1.12.0.nupkg 2015-11-18T08:35:24.5688946ZC:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\agent\worker\tools\NuGet.exe push C:\a\1\s\EventViewer\bin\Release\Project.Name.1.1.12.0.nupkg -s https://example.pkgs.visualstudio.com/DefaultCollection/_packaging/Example/nuget/v3/index.json usfusmx4ez6mlfqwpp2abzc7e37denfcp7bxsep2hqij3tp4qwvq 2015-11-18T08:35:25.3467312Z Please provide credentials for: https://example.pkgs.visualstudio.com/DefaultCollection/_packaging/Example/nuget/v3/index.json 2015-11-18T08:35:25.3667189Z ##[error]Object reference not set to an instance of an object. 2015-11-18T08:35:25.3677179Z UserName: Password: 2015-11-18T08:35:25.4647059Z ##[error]Unexpected exit code 1 returned from tool NuGet.exe 

I also tried using the access token to no avail.

How do I get the publishing step to work?

+6
source share
3 answers

The NuGet Publish in-box task has two options: "external" channels and "internal" channels. External channels are intended for third-party services, such as NuGet.org, Artifactory, and await connection to the service with the API key.

Internal channels are those hosted by Team Services. Instead of connecting to the service, you add the NuGet endpoint URL. The assembly system is based on the assembly project assembly service (for assembly definitions with a collection extension) or in the project assembly service (for "this project"), which is a Reader or Contributor for the feed. Documents for all available here .

+4
source

UPDATE: now everything is fixed, so you can use the standard packaging steps in vNext, and they work like a charm.

I am currently replacing the NuGet Publisher step with the PowerShell build step .

These are slots into the assembly after the “NuGet Packager” step and allows me to specify all the credentials by customizing the package source code before starting the package.

 $feedUrl = "https://example.pkgs.visualstudio.com/DefaultCollection/_packaging/Example/nuget/v3/index.json" $packagePath = $ENV:BUILD_REPOSITORY_LOCALPATH + "\YourOrg.YourComponent." + $ENV:BUILD_BUILDNUMBER + ".nupkg" Write-Host "Adding package Source" $addSourceCommand = $ENV:BUILD_REPOSITORY_LOCALPATH + "\nuget sources add -name ""Example"" -source " + $feedUrl + " -username ""your.username"" -password ""yourpassword""" Invoke-Expression -Command $addSourceCommand Write-Host "Pushing package to NuGet" $pushCommand = $ENV:BUILD_REPOSITORY_LOCALPATH + "\nuget push $packagePath -Source " + $feedUrl + " -ApiKey Example" Invoke-Expression -Command $pushCommand 
+3
source

I landed here because I am studying / setting up internal deployment, where I run my own NuGet server (nuget.server, unlike the visual studio online). The error was the same (or has similar text):

Object reference not set to object instance

My solution turned out to be that the url was wrong. Correct version: http://server-name/NuGet/api/v2/package

For completeness, I had: http://server-name/NuGet/ , which was wrong.

0
source

All Articles