/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) { return; } try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) { if (_cacheRepository == null) { _cacheRepository = MachineCache.Default; } } //TODO This needs injecting.... if (_packageCache == null) { _packageCache = new MemoryBasedPackageCache(Console); } _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) { _baseDirectory = Environment.CurrentDirectory; } var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}", e.Message), e); } }
/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) return; try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) if (_cacheRepository == null) _cacheRepository = MachineCache.Default; //TODO This needs injecting.... if (_packageCache == null) _packageCache = new MemoryBasedPackageCache(Console); _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) _baseDirectory = Environment.CurrentDirectory; var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}",e.Message),e); } }