首页 > 解决方案 > 访问私有 Nuget 提要时出错

问题描述

尝试从 Azure 包工件访问私有 NuGet 源时出现错误。

Install-Package Microsoft.Sdk -version 1.0.0-CI-20191028-053209

The content at 'https://mp.visualstudio.com/Tools/_packaging?_a=feed&feed=Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0' is not valid XML.
  For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.
  GET https://mp.visualstudio.com/Tools/_packaging?_a=feed&feed=ocpdirectory%40Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0
  NonAuthoritativeInformation https://mp.visualstudio.com/Tools/_packaging?_a=feed&feed=ocpdirectory%40Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0 429ms
Install-Package : Failed to retrieve information about 'Microsoft.Sdk' from remote source 'https://mpneng.visualstudio.com/Tools/_packa
ging?_a=feed&feed=Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0'.
  The content at 'https://mp.visualstudio.com/Tools/_packaging?_a=feed&feed=Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0' is not valid XML.
  For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass 
the settings into XmlReader.Create method.
At line:1 char:1
+ Install-Package Microsoft.Sdk -version 1.0.0-CI-2019102 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

标签: azure-devopsnuget-packageprivate-nuget-feed

解决方案


The content at 'https://mp.visualstudio.com/Tools/_packaging?_a=feed&feed=Release/FindPackagesById()?id='Microsoft.Sdk'&semVerLevel=2.0.0' is not valid XML.

根据错误日志,您似乎使用了错误的 URL,我们应该使用“连接到 feed ”说明中提供的 URL。

示例 URL 链接

https://pkgs.dev.azure.com/{Org name}/{project name}/_packaging/{artifact name}/nuget/v3/index.json

推荐阅读