public DirectoryPath InstallPackage(PackageDefinition package, DirectoryPath root) { var packagePath = root.Combine("libs"); if (!_fileSystem.Exist(packagePath)) { _fileSystem.GetDirectory(packagePath).Create(); } if (!_fileSystem.Exist(packagePath.Combine(package.PackageName))) { var packageManager = CreatePackageManager(packagePath); if (!string.IsNullOrWhiteSpace(package.Version)) { // Install specific version. packageManager.InstallPackage(package.PackageName, new SemanticVersion(package.Version), true, true); } else { // Install latest version. packageManager.InstallPackage(package.PackageName); } } // Return the installation directory. return(packagePath.Combine(package.PackageName)); }
public DirectoryPath InstallPackage(PackageDefinition package, DirectoryPath root) { var packagePath = root.Combine("libs"); if (!_fileSystem.Exist(packagePath)) { _fileSystem.GetDirectory(packagePath).Create(); } if (!_fileSystem.Exist(packagePath.Combine(package.PackageName))) { var packageManager = CreatePackageManager(packagePath); packageManager.InstallPackage(package.PackageName); } // Return the installation directory. return(packagePath.Combine(package.PackageName)); }