Search code examples
visual-studiosetup-projectprerequisites

How can I determine the prerequisites for my program to run on a new, "fresh" system?


I've completed work on a project that is all ready to go except for one problem : Upon installation, it fails to run on a fresh system (that is, one that has never been updated, had anything installed to it, or anything else).

The system installs by a Microsoft Setup and Deployment project, and successfully downloads .Net Framework 4.5 but it still fails to run, and the error is completely useless.

The program is written on the .Net 4.5 framework, and is written in C#/WPF/XAML. Other than needing .Net 4.5, what other prerequisites should I be checking for/downloading to the target system?

When I say "It fails to run", what I mean is that the program does not launch. The user double-clicks the shortcut, and they get a message box that says

PROGRAM has stopped working.

A problem has caused the program to stop working correctly.

Windows will close the program and notify you if a solution is available

Also; The program works perfectly fine on other systems, it's just it seems systems fresh out of the box it fails on (in the manner as noted above).


Solution

  • The short answer is that you need to identify the software your program uses that is not part of the .NET Framework. That might include Crystal Reports, some SQL components, any third party NET controls, COM components. Typically the first cut is Microsoft vs 3rd party because 3rd party software will not be on someone's random system. After that, see what Microsoft components you might be using that are separate redistributables.

    It may be useful to have a message box as the first thing your program does (as a test). If it's all .NET and it starts, then probably most of the NET references are there. If it doesn't start you are probably missing a referenced assembly. If it crashes later, then all you need is some diagnostic or trace data (and error handling) to see if you trying to do something like create a COM object that hasn't been installed.

    However if it's not a dependency issue then it could be an architecture issue if you have an AnyCpu build and trying to call a Dll with the wrong bitness, and not designing for 64-bit and 32-bit systems. Or if you're doing something really unusual, Data Execution Prevention might be preventing the program from running - I think you'll see that message in those cases. I also suspect that some AntiVirus programs will step in and cause this error if they see the code doing something prohibited.