Azure Pipelines YAML-dotnet nuget推送失败,出现意外的令牌错误

时间:2019-04-11 12:04:38

标签: azure-pipelines

设置我的第一个YAML管道时,将程序包推送到内部Az DevOps提要时出现了一个奇怪的错误。

这是YAML的重要部分。

- task: DotNetCoreCLI@2
  displayName: 'Push this package to the feed'
  inputs:
    command: 'push'
    nuGetFeedType: 'internal'
    packagesToPush: '$(build.artifactStagingDirectory)/*.nupkg'
    publishVstsFeed: 'https://mycompany.pkgs.visualstudio.com/_packaging/Packages/nuget/v3/index.json'

结果。

  

错误:NuGet.Config无效的XML。路径:“ d:\ a \ 1 \ NuGet_74 \ NuGet.Config”。   错误:“ /”是意外令牌。预期的标记是“>”。第1行,位置365。

从较大的输出中:

##[section]Starting: DotNetCoreCLI
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version      : 2.149.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
[command]C:\windows\system32\chcp.com 65001
Active code page: 65001
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
##[warning]Can\'t find loc string for key: Warning_SessionCreationFailed
##[warning]Warning_SessionCreationFailed {"statusCode":500,"result":{"$id":"1","innerException":null,"message":"A potentially dangerous Request.Path value was detected from the client (:).","typeName":"Microsoft.VisualStudio.Services.Common.VssServiceException, Microsoft.VisualStudio.Services.Common","typeKey":"VssServiceException","errorCode":0,"eventId":3000}}
Saving NuGet.config to a temporary config file.
Saving NuGet.config to a temporary config file.
[command]C:\hostedtoolcache\windows\dncs\2.2.104\x64\dotnet.exe nuget push d:\a\1\a\Demo.HypermediaClient.1.0.0.nupkg --source https://mycompany.pkgs.visualstudio.com/_packaging/https%3A%2F%2Fmycompany.pkgs.visualstudio.com%2F_packaging%2FPackages%2Fnuget%2Fv3%2Findex.json/nuget/v3/index.json --api-key VSTS
error: NuGet.Config is not valid XML. Path: 'd:\a\1\NuGet_74\NuGet.Config'.
error:   '/' is an unexpected token. The expected token is '>'. Line 1, position 365.
##[error]Error: C:\hostedtoolcache\windows\dncs\2.2.104\x64\dotnet.exe failed with return code: 1
##[error]Packages failed to publish
##[section]Finishing: DotNetCoreCLI

NuGet.Config文件是正常的,否则可以与其他命令和VS一起使用。

<configuration>
    <packageSources>
        <clear />
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    </packageSources>
</configuration>

警告是可疑的...我将继续查找并回发我的发现。

1 个答案:

答案 0 :(得分:1)

好的,这很奇怪。错误中的该URL被弄乱了。嗯。

https://mycompany.pkgs.visualstudio.com/_packaging/https://mycompany.pkgs.visualstudio.com/_packaging/Packages/nuget/v3/index.json/nuget/v3/index.json

仅尝试使用我在YAML中publishVstsFeed的软件包名称。

排序。就是这样。

答案publishVstsFeed仅需要供稿名称部分。