Home: Dotnet restore fails to use the local Nuget.Config to retrieve nuget packages from private feeds while building docker image

Created on 10 Mar 2017  路  3Comments  路  Source: NuGet/Home

From @JayBee6 at https://github.com/dotnet/cli/issues/5959

Steps to reproduce

add a Nuget.Config to your project with a private feed and run dotnet restore as part of docker build. Below is the basic Docker file that I am using.

FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app
RUN ["dotnet", "restore"]
RUN ["dotnet", "build"]
EXPOSE 80
CMD ["dotnet", "run", "--server.urls", "http://*:80"]

Dotnet restore fails because it is not using the package sources from the nuget.config file inside the project. Below is the Nuget.Config file that I am using (mocking the private feed name).

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <packageSources>
    <clear/>
    <add key="private package source" value="http://artifactory.private.svc/artifactory/api/nuget/nuget-release-local" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Expected behavior

NuGet Config files used:
/root/appName/Nuget.Config
/root/.nuget/NuGet/NuGet.Config

Feeds used:
http://artifactory.private.svc/artifactory/api/nuget/nuget-release-local
https://api.nuget.org/v3/index.json

Actual behavior

NuGet Config files used:
/root/.nuget/NuGet/NuGet.Config

Feeds used:
https://api.nuget.org/v3/index.json

Environment data

dotnet --info output:

dotnet --info
.NET Command Line Tools (1.0.1)

Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/1.0.1

Question

Most helpful comment

@jaybee6 the allows casings of the config file are:

  • NuGet.Config
  • NuGet.config
  • nuget.config

Nuget.Config is not supported.

All 3 comments

@jaybee6 the allows casings of the config file are:

  • NuGet.Config
  • NuGet.config
  • nuget.config

Nuget.Config is not supported.

@emgarten @livarcocc Thanks guys that fixed the issue, there are lot of misleading articles online with the incorrect case. Is there any harm in making it case insensitive?

Perf is an issue, to load the settings we need to search all parent directories. In order to make this case sensitive it would need to list all of these directories instead of performing a much faster file exists check on the known names.

Was this page helpful?
0 / 5 - 0 ratings