Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Framework 4.0 does not install when 4.5 is already installed

I use Visual Studio 2012 for a WPF project needing (at least) .NET Framework 4.0. I have 4.5 already installed, but people with Windows XP cannot install the application (because 4.5 does not run on Windows XP). I use ClickOnce as the deployment application.

When I try to intall version 4.0, I get the error (translated from Dutch so the English version might be a bit different):

The same or a higher version of .NET Framework 4 is already installed on this computer

How can I fix this?

like image 387
Michel Keijzers Avatar asked Jan 28 '13 20:01

Michel Keijzers


2 Answers

Simple, just check the control panel and uninstall the higher version and carry on with the installation.

like image 73
Neel Avatar answered Oct 04 '22 03:10

Neel


.NET Framework 4.5 is an in-place update and replaces .NET Framework 4. Once you install .NET Framework 4.5 there is no way to go back to .NET Framework 4. Note that major and minor versions of .NET Framework 4.5 assemblies were not changed. This means that a .NET Framework 4 app does not "see" a difference between the two and should run the same way. Since you want apps run on Windows XP you need to target .NET Framework 4 in your project. This will ensure that your app is not using any new APIs added in .NET Framework 4.5. After you do this you should be able to run your app on both .NET Framework 4 and .NET Framework 4.5. Note that even though the compatibility bar was very high (due to .NET Framework 4.5 being an in-place update) you will still find some minor differences (e.g. bugs that caused exceptions in .NET Framework 4 might have been fixed in .NET Framework 4.5 and exceptions are not throw anymore) and therefore you need to test your app on .NET Framework 4 machine thoroughly since running it on .NET Framework 4.5 will not reveal some issues. The reason for this is that targetting ensures that the app is not using APIs that did not exist before but cannot ensure the behavior at runtime since on the machine with .NET Framework 4.5 it will always use .NET Framework 4.5 runtime (since there is no .NET Framework 4 runtime there anymore).

like image 28
Pawel Avatar answered Oct 04 '22 03:10

Pawel