Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployed .net app on new machine and getting "The system cannot execute the specified program"

Tags:

.net

.net-2.0

I have a .net console app that launches excel. I have it working on my development enviornment, but I can't get it running on my production environment. When I try to run it I receive the following error "The system cannot execute the specified program". I have installed .net 2.0 sp2 on my production server. Any ideas?

Thank you,

Code

static void Main(string[] args) 
{ 

  DateTime priceDate; 
  bool runningForMidDay; 
  if (args.Length == 0) 
  { 
   priceDate = DateTime.Now; 
   runningForMidDay = false; 
  } 
  else 
  { 
     if (args[0].ToString() == "-?") 
     { 
        Console.WriteLine("This application..."); 
        Console.ReadLine(); 
        return; 
     } 
     if (!DateTime.TryParse(args[0].ToString(), out priceDate)) 
        priceDate = DateTime.Now; 
     if (!bool.TryParse(args[1].ToString(), out runningForMidDay)) 
        runningForMidDay = false; 
  } 
  if (runningForMidDay) 
  { ... } 
  else 
  { ... } 
}
like image 266
mikemurf22 Avatar asked Apr 17 '26 13:04

mikemurf22


2 Answers

They say there is no such thing as a dumb question, just dumb people. Well that is the case here. I had an error in my config file. I have corrected the config file and it works.

like image 139
mikemurf22 Avatar answered Apr 19 '26 07:04

mikemurf22


I've seen this sort of thing happen previously when the C runtime libraries aren't installed on the deployment machine; normally they're not necessary, but they may be required since your app launches Excel.

like image 42
Paul Sonier Avatar answered Apr 19 '26 06:04

Paul Sonier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!