install prerequisite before run exe program

hi All,

I have made a little exe that dose something by using .net framework 2.0
it will be run on many different machines, and I am wondering how to make it check if .net framework 2.0 is installed before run it. if not, start installation .net 2.0 right away and then run my exe program.

note: my exe program does not have installation......
Who is Participating?
Jacques Bourgeois (James Burger)Connect With a Mentor PresidentCommented:
Through an installation program.

Do you see commercial applications that do not need an installation program? There is a good reason for that, You need an installation program in order to install a program. Simply copying a few files might be enough for updates, but in order to make sure that a program has all the prerequisites installed before the program, you need some sort of installation program.

If it is in-house installation, lookup ClickOnce in the documentation. Otherwise, look for deployment.
your program will not run or will show an errormessage.

you will need to check if .NET 2.0 is missing before you start your application.

There is an Application i know:

if u want to develope an own application for that read here:;EN-US;Q318785
IkelcaAuthor Commented:
yes, i knew it will display error msg,
what I want is a way to prompt user to installation of .net 2.0 if there isn't one before start running my program.
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

Jacques Bourgeois (James Burger)PresidentCommented:
You can't. The only way to do that is through an installer program that can install the framework along your application.

Do you think that you could get a program to check if Windows is already installed and tell the user to install it? This is the same with the framework. You need to install Windows before you run a Windows program, you need to install the framework before you install a .NET program.

Before even getting into your program, the user will get an error tellling that mscorlib is missing. mscorlib if the common language runtime that is at the base of everything in the framework.

But I would be very surprised if you ended up with a user that would not be able to run an application build for the framework 2. Unless your are doing very special things, your application will also run on any more recent version of the framework (3.0, 3.5, 4.0). Version 2.0 is 9 years old. Unless your users are working in a very closed down environment, the chances that they do not already have the framework installed by another application is minimal.

Many programs, even programs that are not created in .NET, install the framework. Many games nowadays have a .NET launcher. Office installs .NET. If comes preinstalled in Vista and Windows 7.
IkelcaAuthor Commented:
the problem is i do have some machines that do not have .net2.0
this usually gave me headache....
you can maybe start the installer of .net before starting the application.
IkelcaAuthor Commented:
If you are planning installation program then why you don't go for your actual application installation + prerequisite setup? I think, it would be difficult to user to track installation program and application executable differently.
IkelcaAuthor Commented:
i dont plan to have my program installed, this was in my first statement......the program is small utility, no need to install
gery128Connect With a Mentor Commented:
That I can understand, but If you are going to install prerequisites through a installable program (i.e. for .net framework setup) you are performing installation on client's PC.

Though, you can avoid this prerequisite installation if you show proper message in your utility and provide link to download .NET Framework to install at client side.

Otherwise if your utility is limited to intranet (LAN), you can go for click-once as suggested by JamesBurger.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.