private static string ValidateConsumerProject(string filePath) { if (filePath != null) { if (File.Exists(filePath)) { return(filePath); } FullUI.FatalError(() => $"Error: File does not exist: {filePath}"); return(null); } filePath = Directory .GetFiles(Directory.GetCurrentDirectory(), "*.*") .FirstOrDefault(path => path.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) || path.EndsWith(".sln", StringComparison.OrdinalIgnoreCase)); if (filePath == null) { FullUI.FatalError(() => $"Error: No .sln/.csproj file found in current directory, and {"--consumer"} was not specified"); return(null); } return(filePath); }
private static string ValidateTargetProject(string filePath) { if (File.Exists(filePath)) { return(filePath); } FullUI.FatalError(() => $"Error: File does not exist: {filePath}"); return(null); }
private static int ExecuteCommand( string commandName, NuLinkCommandOptions options, bool isValid) { if (!isValid) { return(1); } try { var command = CreateCommand(commandName, options); command.Execute(options); return(0); } catch (Exception e) { FullUI.FatalError(() => $"Fatal error: {e.Message}\nException: {e}"); return(100); } }