protected override async Task <object> RemoteExecuteAsync(IRemoteOperationExecutionContext context) { var client = new ProGetClient(this.Server, this.FeedName, this.UserName, this.Password, this, context.CancellationToken); try { this.LogInformation($"Pushing package {this.Name} to ProGet..."); string path = context.ResolvePath(this.FilePath); this.LogDebug("Using package file: " + path); if (!FileEx.Exists(path)) { this.LogError(this.FilePath + " does not exist."); return(null); } if (string.IsNullOrWhiteSpace(this.Name) || string.IsNullOrWhiteSpace(this.Version)) { try { using (var package = new UniversalPackage(path)) { if (string.IsNullOrWhiteSpace(package.Name) || package.Version == null) { this.LogError("Name and Version properties are required unless pushing a package that already has those properties set."); return(null); } } } catch { this.LogError("Name and Version properties are required unless pushing a package that already has those properties set."); return(null); } } using (var file = FileEx.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { var data = new ProGetPackagePushData { Title = this.Title, Description = this.Description, Icon = this.Icon, Dependencies = this.Dependencies?.ToArray() }; await client.PushPackageAsync(this.Group, this.Name, this.Version, data, file); } } catch (ProGetException ex) { this.LogError(ex.FullMessage); return(null); } this.LogInformation("Package pushed."); return(null); }
protected override async Task <object> RemoteExecuteAsync(IRemoteOperationExecutionContext context) { var client = new ProGetClient(this.Server, this.FeedName, this.UserName, this.Password, this); try { this.LogInformation($"Pushing package {this.Name} to ProGet..."); string path = context.ResolvePath(this.FilePath); this.LogDebug("Using package file: " + path); if (!FileEx.Exists(path)) { this.LogError(this.FilePath + " does not exist."); return(null); } using (var file = FileEx.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)) { var data = new ProGetPackagePushData { Title = this.Title, Description = this.Description, Icon = this.Icon, Dependencies = this.Dependencies?.ToArray() }; await client.PushPackageAsync(this.Group, this.Name, this.Version, data, file).ConfigureAwait(false); } } catch (ProGetException ex) { this.LogError(ex.FullMessage); return(null); } this.LogInformation("Package pushed."); return(null); }