Joh*_*err 44
NuGet包源是通过Visual Studio配置的,但它们存储在每个用户配置文件中,位于c:\Users\$USER\AppData\Roaming\NuGet\NuGet.config
.需要将TeamCity包源的条目添加到运行构建的构建代理用户的配置文件中.
编辑: ladenedge记录了一个很好的解决方案,当我最初回答这个问题时,这个解决方案并不存在.如果您没有构建代理的管理员权限,或者希望基于每个项目配置程序包源,则该解决方案特别有用.
lad*_*dge 26
NuGet现在可以从NuGet.targets
存储在源本身的文件中读取源,如重复问题的答案中所述.
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<PackageSource Include="https://nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
Iva*_*van 19
我不想在源代码中添加NuGet.config中的feed,因为这是构建基础结构的一部分而不是应用程序代码的一部分.
我不想在TeamCity构建代理上添加NuGet.config中的 feed,因为它很难维护(更新,添加,删除),而且我们有很多构建代理.
什么对我来说最有效 - 在TeamCity中添加%system.PackageSources%(在Root项目上),包含全局nuget feed和我的自定义(以分号分隔):
https://www.nuget.org/api/v2/ ; HTTP:// <teamcity_server_name>:81/guestAuth /应用程序/的NuGet/V1/FeedService.svc
如果你看看NuGet.Targets,你会看到它使用$(PackageSources),如果它被定义的话.因此,您在TeamCity中将其定义为"system"参数,并将其传递给构建过程.
归档时间: |
|
查看次数: |
19997 次 |
最近记录: |