VSO NuGet Publisher Build Step Fails

后端 未结 3 1245
长发绾君心
长发绾君心 2021-01-01 00:33

I am using Visual Studio Online - Package Manager Preview, along with the new build system. The package manager preview adds a number of build steps, including a \"NuGet Pub

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-01 00:56

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

    For the time being, I am substituting the NuGet Publisher step with a PowerShell build step.

    This slots into the build after the "NuGet Packager" step and allows me to specify all of the credentials by setting up a package source before pusing 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
    

提交回复
热议问题