... using Microsoft.Cognitive.CustomVision.Training; using Microsoft.Rest; using System; using System.Linq; using System.Threading.Tasks; ... namespace VisionRacing.TrainingRacingImages { class Program { static void Main(string[] args) { var trainingKey = "Your Custom Vision training key."; Start(trainingKey).Wait(); } private static async Task Start(string trainingKey) { var projectName = " "; var trainingApi = GetTrainingApi(trainingKey); while (!string.IsNullOrEmpty(projectName)) { try { Console.Clear(); await ListProjects(trainingApi); Console.WriteLine("Please enter a project name or press enter to exit:"); projectName = Console.ReadLine(); if (!string.IsNullOrEmpty(projectName)) { await WorkOnProject(trainingApi, projectName); } } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"An error occurred: {Environment.NewLine}{ex.Message}"); if (ex is HttpOperationException) { Console.WriteLine(((HttpOperationException)ex).Response.Content); } Console.ResetColor(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Press any key to continue"); Console.ReadLine(); } } } ... private static TrainingApi GetTrainingApi(string trainingKey) { return new TrainingApi { ApiKey = trainingKey }; } private static async Task ListProjects(TrainingApi trainingApi) { var projects = await trainingApi.GetProjectsAsync(); if (projects.Any()) { Console.WriteLine($"Existing projects: {Environment.NewLine}{string.Join(Environment.NewLine, projects.Select(p => p.Name))}{Environment.NewLine}"); } } ... } }