I have this Assembly targeted at .NET 3.5. The code will work on later versions as well, but I like this to work on Windows XP. I mean, .NET is backwards compatible, right? I can run apps for .NET 3.5 on Windows 8.1.
However, when I run my own assembly, it wants to install .NET 3.5 first, even though I already have 4.5.1 installed.
How can I prevent installing 3.5 when something newer is already installed, while remaining 3.5 compatible?
Best How To :
.NET version is the only version that the app will depend upon by default. Visual Studio will not automatically add higher and backwards compatible releases.
Do this manually by adding other .NET versions to a configuration file:
- On the Visual Studio menu bar:
- Choose Project;
- Add New Item;
- Choose General from the left pane;
- Choose Application Configuration File;
- Name the configuration file appName.exe.config.
- Add an item for every .NET version like so:
<?xml version="1.0" encoding="utf-8" ?>
See MSDN: Configure an App to Support .NET Framework 4 or 4.5
The .NET Framework 4.5 and its point releases are backward-compatible with apps that were built with earlier versions of the .NET Framework. In other words, apps and components built with previous versions will work without modification on the .NET Framework 4.5. However, by default, apps run on the version of the common language runtime for which they were developed, so you may have to provide a configuration file to enable your app to run on the .NET Framework 4.5. For more information, see the Version compatibility for apps section earlier in this article.