TFS2012 build server not restoring NuGet packages from in-house repository

旧巷老猫 提交于 2019-11-28 19:38:52

change your build to run as a specific account. you can then logon with that account and prove off all of these little snags.

depending on which way you are doing the NuGet restore, have you updated the targets file with the location of your local feed?

<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://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
        <!--
            <PackageSource Include="https://www.nuget.org/api/v2/" />
            <PackageSource Include="https://my-nuget-source/nuget/" />
        -->
      <PackageSource Include="http://MyLocalFeed/nuget/nuget"/>

    </ItemGroup>

You can add the source to a machine-wide config on the TFS build server and it will be included in the list of sources when doing package restores.

What I did was create a file %ProgramData%\NuGet\Config\sources.config that contained:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="internal source" value="http://internal_server/nuget/" />
  </packageSources>
</configuration>

The name of the file doesn't matter, it's the location of the file. Nuget picks up any .config files under that folder.

http://docs.nuget.org/docs/reference/NuGet-Config-File#NuGet_config_extensibility_point

UPDATE 2016-11-18 According to http://blog.nuget.org/20161121/introducing-nuget4.0.html (under breaking changes), VS 2017+ and NuGet 4.0+ changes the location of the machine-wide config folder to %ProgramFiles(x86)%\NuGet\Config\.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!