I have a VS2017 c# console app that I have published and when I click on Setup.exe it gives the following error:
Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at MyprojectName.Sender.MailSender.SendNotification(String[] args)
at MyprojectName.Program.Main(String[] args)
Here is the code from the Main method:
static void Main(string[] args)
{
MailSender sender = ((UnityContainer)UnityConfig.GetConfiguredContainer()).Resolve<MailSender>();
sender.SendNotification(args);
}
The console app is expecting arguments but not sure why its raising this during the setup/Install. The console app is part of a larger solution so I right click on the console app project and select publish, set the publish path, click "From a CD-ROM or DVD-ROM", Click "The application will not check for updates" and click Finish.
It publishes successfully. I then click on the Setup.exe and it gives me the error.
In the properties of the project for Debug I have the two parameters its expecting in the Command Line Arguments. So if I debug the application it runs as expected.