Azure DevOps设置多个源以还原包

Azure DevOps设置多个源以还原包,azure,azure-devops,azure-pipelines,azure-pipelines-build-task,Azure,Azure Devops,Azure Pipelines,Azure Pipelines Build Task,尝试为我的ServiceStack软件包设置Azure DevOps管道和当前还原软件包失败,因为我需要的版本不在默认的nuget.org提要中。我想要的版本在MyGet.org提要中 如何以及在何处在dev.azure.com门户中为该附加包设置附加MyGet提要,以便azure DevOps可以还原它 生成失败 "D:\a\1\s\SomeApi\SomeApi.csproj" (Restore target) (1) -> (Restore target) ->

尝试为我的ServiceStack软件包设置Azure DevOps管道和当前还原软件包失败,因为我需要的版本不在默认的nuget.org提要中。我想要的版本在MyGet.org提要中

如何以及在何处在dev.azure.com门户中为该附加包设置附加MyGet提要,以便azure DevOps可以还原它

生成失败

   "D:\a\1\s\SomeApi\SomeApi.csproj" (Restore target) (1) ->
   (Restore target) -> 
     D:\a\1\s\SomeApi\SomeApi.csproj : error NU1102: Unable to find package ServiceStack with version (>= 5.4.1)## Heading ##
   D:\a\1\s\SomeApi\SomeApi.csproj : error NU1102:   - Found 181 version(s) in nuget.org [ Nearest version: 5.4.0 ]

0 Warning(s)
1 Error(s)
无论在何处运行nuget restore,都应该引用的本地副本。例如:

或者,如果NuGet.Config位于.sln旁边,则应自动使用它。

在运行NuGet restore的任何位置都应引用的本地副本。例如:

或者,如果NuGet.Config位于.sln旁边,则应自动使用它

Azure DevOps设置多个源以还原包

您可以在解决方案资源管理器上右键单击解决方案,然后添加包含以下内容的nuget.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="MyGetCustomFeed" value="https://dotnet.myget.org/xxx/v3/index.json" />
  </packageSources>

  <packageSourceCredentials>
    <MyGetCustomFeed>
      <add key="Username" value="xxx" />
      <add key="ClearTextPassword" value="xxxx" />
    </MyGetCustomFeed>
  </packageSourceCredentials>
</configuration>
然后将此文件提交到您的repo,并在nuget restore任务中选择此文件:

希望这有帮助

Azure DevOps设置多个源以还原包

您可以在解决方案资源管理器上右键单击解决方案,然后添加包含以下内容的nuget.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="MyGetCustomFeed" value="https://dotnet.myget.org/xxx/v3/index.json" />
  </packageSources>

  <packageSourceCredentials>
    <MyGetCustomFeed>
      <add key="Username" value="xxx" />
      <add key="ClearTextPassword" value="xxxx" />
    </MyGetCustomFeed>
  </packageSourceCredentials>
</configuration>
然后将此文件提交到您的repo,并在nuget restore任务中选择此文件:


希望这能有所帮助。

由于一些奇怪的原因,当我的nuget.config与解决方案文件位于同一文件夹中时,似乎没有接收提要。但是,在我的NuGet.config中指定提要并将路径设置为NuGet.config,而不使用任何文件夹名称,这就为我解决了这个问题。谢谢。@richardb,是的,当您在nuget还原中使用nuget.config文件时,您需要为其指定路径,否则,nuget还原将在默认路径C:\Users\\AppData\Roaming\nuget\nuget.config中搜索默认的nuget.config。此外,如果上述答案解决了您的问题,您可以将其作为答案接受,以便我们将其存档。谢谢。由于一些奇怪的原因,虽然我的nuget.config与解决方案文件位于同一文件夹中,但似乎没有接收提要。但是,在我的NuGet.config中指定提要并将路径设置为NuGet.config,而不使用任何文件夹名称,这就为我解决了这个问题。谢谢。@richardb,是的,当您在nuget还原中使用nuget.config文件时,您需要为其指定路径,否则,nuget还原将在默认路径C:\Users\\AppData\Roaming\nuget\nuget.config中搜索默认的nuget.config。此外,如果上述答案解决了您的问题,您可以将其作为答案接受,以便我们将其存档。谢谢。谢谢-您的答案和Leo在此处提供了帮助-必须指定Nuget.config的路径,因为尽管事实与解决方案文件位于同一文件夹中,但似乎没有自动找到它。谢谢-您的答案和Leo在此处提供了帮助-必须指定Nuget.config的路径,因为尽管事实与解决方案文件位于同一文件夹中,似乎没有自动找到它文件夹作为解决方案文件。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="MyGetCustomFeed" value="https://dotnet.myget.org/xxx/v3/index.json" />
  </packageSources>

  <packageSourceCredentials>
    <MyGetCustomFeed>
      <add key="Username" value="xxx" />
      <add key="ClearTextPassword" value="xxxx" />
    </MyGetCustomFeed>
  </packageSourceCredentials>
</configuration>