Assumption:
* There is a Visual Studio project (.csproj) without related solution (.sln) yet
If there isn't a packages folder in the "top-level" folder of the .csproj file folder, "Nuget pack" does not recognize the dependencies defined in the package.config next to a .csproj file.
To overcome this issue, you can place an empty solution (.sln) and a nuget.config (containing the path of the packages folder) on the top-level folder of the .csproj folder.
__Example:__
Assume you have the folder structure:
* MyProjects\MyProject\MyProject.csproj
* MyProjects\MyProject\packages.config
In order to make "nuget pack" recognize the dependencies defined in packages.config you have to place the following files in the MyProjects folder, otherwise it won't work:
* MyProjects\MyEmpty.sln
* MyProjects\nuget.config (containing path of packages folder)
So, the question is why is there this empty .sln or even the nuget.config with the path to the packages folder necessary? The packages.config next to the .csproj file should be totally sufficient for "nuget pack" to add the dependencies.
Comments: Currently I'm using TeamCity to build and zip up an artifact that does not contain the packages folder (to save space, especially in bigger repos), but I then lose the ability to pull in dependencies from packages.config automatically. I Would love to have the packages folder not be a requirement for nuget pack to pull in dependencies from packages.config. Like WebWolf42 I don't see why packages.config and the csproj file aren't enough to build the dependency.
* There is a Visual Studio project (.csproj) without related solution (.sln) yet
If there isn't a packages folder in the "top-level" folder of the .csproj file folder, "Nuget pack" does not recognize the dependencies defined in the package.config next to a .csproj file.
To overcome this issue, you can place an empty solution (.sln) and a nuget.config (containing the path of the packages folder) on the top-level folder of the .csproj folder.
__Example:__
Assume you have the folder structure:
* MyProjects\MyProject\MyProject.csproj
* MyProjects\MyProject\packages.config
In order to make "nuget pack" recognize the dependencies defined in packages.config you have to place the following files in the MyProjects folder, otherwise it won't work:
* MyProjects\MyEmpty.sln
* MyProjects\nuget.config (containing path of packages folder)
So, the question is why is there this empty .sln or even the nuget.config with the path to the packages folder necessary? The packages.config next to the .csproj file should be totally sufficient for "nuget pack" to add the dependencies.
Comments: Currently I'm using TeamCity to build and zip up an artifact that does not contain the packages folder (to save space, especially in bigger repos), but I then lose the ability to pull in dependencies from packages.config automatically. I Would love to have the packages folder not be a requirement for nuget pack to pull in dependencies from packages.config. Like WebWolf42 I don't see why packages.config and the csproj file aren't enough to build the dependency.