Search code examples
nuget

NuGet.Config does not contain the expected root element: 'configuration'


We recently switched from nuget.exe 3.3 to 5.5 and because of the switch we are receiving the following error:

NuGet.Config does not contain the expected root element: 'configuration'.

Running the following command via nuget.exe

nuget.exe restore  ..\path\solutionfolder\solution.sln -ConfigFile ..\path\solutionfolder\projectfolder\packages.config

Something we are doing is not correct.

Packages.config looks as follows:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Elasticsearch.Net" version="6.0.1" targetFramework="net46" />
    </packages>

Solution

  • The issue turned out to be quite simple, we should not have had the ConfigFile command line entry present.

    nuget.exe restore  ..\path\solutionfolder\solution.sln