public Tuple<string, IEnumerable<string>> InstallPackage(string name, string version, IFileSystemDirectory root, string relativeTargetDirectory, bool dllsOnly, NugetLibraryProfile maxProfile)
{
if (String.IsNullOrWhiteSpace(version))
Run(root, "install", name, "-o", "\""+relativeTargetDirectory+"\"", "-Verbosity", Verbosity);
else
Run(root, "install", name, "-Version", version, "-o", "\"" + relativeTargetDirectory + "\"", "-Verbosity", Verbosity);
var result = new List<string>(); // root relative paths
string commonRoot = String.Empty; // root relative path
var localRoot = root as LocalFileSystemDirectory;
if (localRoot != null)
{
var pkgRoot = new DirectoryInfo(Path.Combine(localRoot.AbsolutePath, relativeTargetDirectory));
var modRoot = FindDirectory(pkgRoot, name);
if (modRoot != null)
{
var libRoot = modRoot.GetDirectories("lib", SearchOption.TopDirectoryOnly).FirstOrDefault();
var contentRoot = modRoot.GetDirectories("content", SearchOption.TopDirectoryOnly).FirstOrDefault();
commonRoot = GetRelativePath(modRoot.FullName, localRoot);
if (libRoot != null)
{
AddDlls(libRoot, result, localRoot, maxProfile);
commonRoot = GetRelativePath(libRoot.FullName, localRoot);
}
if (contentRoot != null && !dllsOnly)
{
AddContents(contentRoot, result, localRoot);
if (libRoot == null)
commonRoot = GetRelativePath(contentRoot.FullName, localRoot);
}
}
}
log.DebugFormat("Returning common root {0}", commonRoot);
return Tuple.Create(commonRoot, result.AsEnumerable());
}