Nuget restore error: This folder contains more than one solution file

Nuget restore error: This folder contains more than one solution file

我有这样的解决方案和项目结构:

projects
|--.nuget
|  |--packages.config
|
|--projFolderA
|  |--projectA.csproj  
|  
|--projFolderB
|  |--projectB.csproj  
|
|--projFolderC
|  |--projectC.csproj  
|    
|--solutionAB.sln
|--solutionBC.sln
|--solutionCA.sln

每个解决方案都配置为使用一些使用 nuget 的库。现在,当我 运行:nuget restore 时,我得到了这个错误: This folder contains more than one solution file. 但是如果我在 VS2013 中打开每个解决方案就没问题了。

这是我的每个 *.sln 文件中的 nuget 设置:

Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{334B5D1D-8694-472B-8170-3D36A395DCEF}"
    ProjectSection(SolutionItems) = preProject
        .nuget\packages.config = .nuget\packages.config
    EndProjectSection
EndProject

我做错了什么?在这种情况下,我如何从控制台 运行 nuget restore

尝试nuget restore solutionABC.sln

https://docs.nuget.org/consume/command-line-reference

请参阅下面的粗体部分,了解您收到错误的原因。

Restore Command Notes

The restore command is executed in the following steps:

Determine the operation mode of the restore command.

If packages.config file is specified, nuget restores packages listed in the packages.config file.

If solution is specified, nuget restores packages for the solution's projects. In this case, nuget needs to locate the solution file.

If solution is a file, that file is used as the solution file.

If solution is a directory, then nuget searches for a *.sln file in that directory. If exactly one file is found, that file is used as the solution file. Otherwise, nuget displays an error message and exits.

If no argument is provided, nuget first looks for solution files in the current directory. If there is just one solution file, nuget will restore packages for that solution. If there are multiple solution files, an error message is displayed and nuget exits.

If there are no solution files, nuget then searches for the packages.config file in the current directory. If the file exists, nuget will restore packages listed in the packages.config file.

If there are no solution files and no packages.config file in the current directory, an error message is displayed and nuget exits.

If the operation mode is restoring for a solution, then -SolutionDirectory option is not applicable. In this case, nuget displays an error message and exits.