2015-07-21 29 views
3

我有解決方案和項目的這種結構:的NuGet恢復錯誤:此文件夾包含一個以上的解決方案文件

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

回答

13

嘗試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.

+0

謝謝。有趣的是,在「nuget.exe」的最後一行,它說:「有關更多信息,請訪問http:// docs.nuget.org/docs/reference/command-line-reference'。該死的懶惰我 –

相關問題