I want to use nuget.exe (version 2.5) in my CI build pipeline to install a package which has dependency to another package.
I have following nuspec file.
<
This is not possible. The behavior of the packages.config file is by design. Only things specified in the packages.config are installed, not their dependencies. All dependencies must be explicitly specified as well.
If you look at the source code you will see that nuget.exe install packages.config (http://nuget.codeplex.com/SourceControl/latest#src/CommandLine/Commands/InstallCommand.cs) uses PackageExtractor.InstallPackage (http://nuget.codeplex.com/SourceControl/latest#src/CommandLine/Common/PackageExtractor.cs):
public static void InstallPackage(IPackageManager packageManager, IPackage package)
{
var uniqueToken = GenerateUniqueToken(packageManager, package.Id, package.Version);
// Prerelease flag does not matter since we already have the package to install and we ignore dependencies.
ExecuteLocked(uniqueToken, () => packageManager.InstallPackage(package, ignoreDependencies: true, allowPrereleaseVersions: true));
}
Note the hard call to ignoreDependencies: true