TeamCity Nuget安装构建步骤不适用于多个来源,其中之一是TC的私人NuGet提要 [英] TeamCity Nuget install build step not working with multiple sources, one of them TC's private NuGet feed

查看:117
本文介绍了TeamCity Nuget安装构建步骤不适用于多个来源,其中之一是TC的私人NuGet提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当将源设置为TeamCity的NuGet服务器时,我在NuGet安装构建步骤中收到以下错误:

I receive the following error in NuGet Install build step when setting sources to TeamCity's NuGet server:

Step 1/4: NuGet install (NuGet Installer) (3s)

[15:11:19][Step 1/4] scan: Searching for nuget.config files

[15:11:19][Step 1/4] install: Installing NuGet packages for packages.config (3s)

[15:11:19][install] NuGet command: C:\TeamCity\buildAgent\tools\NuGet.CommandLine.2.2.0.nupkg\tools\NuGet.exe install C:\TeamCity\buildAgent\work\a4b9de5be22a981\packages.config -OutputDirectory C:\TeamCity\buildAgent\work\a4b9de5be22a981\packages -Source http://localhost:9090/guestAuth/app/nuget/v1/FeedService.svc

[15:11:19][install] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script96367186180319830.cmd

[15:11:19][install] in directory: C:\TeamCity\buildAgent\work\a4b9de5be22a981

[15:11:22][install] The remote server returned an error: (404) Not Found.

[15:11:22][install] Process exited with code 1

[15:11:22][Step 1/4] Step NuGet install (NuGet Installer) failed

如果我将sources字段留空,它将从默认的提要(NuGet社区提要)中找到NuGet程序包,而不是从本地构建和打包并托管在TC的NuGet提要中的程序包.

If I leave sources field blank, it will find the NuGet packages from the default feed (NuGet community feed) but not the ones that are built and packaged locally and hosted within TC's NuGet feed.

您如何在NuGet安装程序构建步骤中同时使用默认供稿和内部TC的NuGet供稿?

How do you use both the default feed and the internal TC's NuGet feed within the NuGet installer build step?

推荐答案

您可以通过nuget.config文件指定仅用于解决方案的自定义供稿.

You can specify custom feeds just for solution via nuget.config file.

关键是要提供凭证部分packageSourceCredentials,如下所示:

The key point is to provide credentials section packageSourceCredentials like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Local" value="http://localhost:9090/httpAuth/app/nuget/v1/FeedService.svc" />
  </packageSources>
  <activePackageSource>
    <add key="Local" value="http://localhost:9090/httpAuth/app/nuget/v1/FeedService.svc" />
  </activePackageSource>
  <packageSourceCredentials>
    <Local>
      <Username>login</Username>
      <Password>pa$$w0rd</Password>
    </Local>
  </packageSourceCredentials>
</configuration>

config文件应位于存储库中sln文件的旁边.

This config file should be next to the sln file in repository.

这篇关于TeamCity Nuget安装构建步骤不适用于多个来源,其中之一是TC的私人NuGet提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆