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

前端 未结 3 715
不知归路
不知归路 2020-12-20 13:33

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 applicati

相关标签:
3条回答
  • 2020-12-20 13:38

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

    0 讨论(0)
  • 2020-12-20 13:49

    .NET 4.5 is an add-on to .NET 4.0 in terms of the CLR, and as such, when you install .NET 4.5, it includes 4.0. There is a known issue with ClickOnce when it is generated on a machine that has .NET 4.5 installed.

    Visual Studio 2012 Update 1 is supposed to fix this issue.

    You can set the .NET framework version for your .NET applications inside Visual Studio. When you want to publish a Windows XP compatible version, you should always select .NET 4 or lower as the target framework.

    The .NET 4.0 Framework should be listed side by side with 4.5.

    Enter image description here

    This is on a normally installed Windows 8 machine, Visual Studio 2012 Ultimate, without having to install any other framework or SDK.

    0 讨论(0)
  • 2020-12-20 14:00

    .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).

    0 讨论(0)
提交回复
热议问题