knocte
knocte

Reputation: 17949

What happens when executing a .NET4.0 app in a computer without .NET4.0 installed?

Very simple question, if you compile a program with .NET 4.0 (a program that explicitly uses a feature from .NET 4.0 which is not available in previous framework versions), say a command line program, and you deploy it to a computer that doesn't have .NET 4.0 (let's say it only has .NET2.0 framework).

What happens when you run the .exe from the command line? Is there an exception thrown? Which exception?

I could test myself but I don't have right now a Windows box handy that lacks this framework version.

Thanks in advance.

Upvotes: 0

Views: 336

Answers (3)

Dor Cohen
Dor Cohen

Reputation: 17080

You will get the following error:

To run this application, you first must install one of the following versions of the .NET Framework: v4.0.30319. Contact your application publisher for instructions about obtaining the appropriate version of the .NET Framework.

Upvotes: 3

Shai Aharoni
Shai Aharoni

Reputation: 1957

You might get an System.IO.FileLoadException with a message:"Could not load file or assembly ... Version 4.0.0 ..." when you try to run a .NET 4 program on a machine with a previous version of .NET installed.

Hope this helps...

Upvotes: 0

Gerald Versluis
Gerald Versluis

Reputation: 34013

You won't be able to start the executable as a whole. You will either get an Exception (in the form of Windows encountered an error.. etc) Or you will get a notice that you don't have the right .NET version (not to sure about this last part though..)

Upvotes: 0

Related Questions