private void EnsureNuGetExe() { if (_fileStorageSvc.FileExists(Constants.DownloadsFolderName, "nuget.exe")) { // Ensure the file exists on blob storage. return; } lock (fileLock) { var package = _packageSvc.FindPackageByIdAndVersion("NuGet.CommandLine", version: null, allowPrerelease: false); if (package == null) { throw new InvalidOperationException("Unable to find NuGet.CommandLine."); } using (var packageStream = _packageFileSvc.DownloadPackageFile(package)) { var zipPackage = new ZipPackage(packageStream); ExtractNuGetExe(zipPackage); } } }