Don, thanks for your help. I found out what the problem was. This code below was not setting the printer.
crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";
So, at the times I tested it where it printed successfully (either in debug mode of the project or when double-clicking the compiled executable file), it was just using the default printer for the currently logged-in user.
I looked further and found the solution in this article: https://scn.sap.com/thread/2099449
Changing from this:
crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";
crystalReport.PrintToPrinter(1, true, 0, 0);
to this:
System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings();
printersettings.PrinterName = PrinterToUse;
printersettings.Copies = 1;
printersettings.Collate = false;
Report.PrintToPrinter(printersettings, new System.Drawing.Printing.PageSettings(), false);
resolved my issue.
For anyone else reading this, if using the code above you get the error: "Settings to access printer are not valid." Use this bit of code on the machine where you plan on running the program to get the list of valid printers (if you're making a console application):
foreach(string myPrinter in System.Drawing.Printing.PrinterSettings.InstalledPrinters){
Console.WriteLine(myPrinter);
}
Console.ReadLine();