Reputation: 25313
I have a desktop application written in .Net 3.5. I want it to be able to run on all versions of Windows with .Net 3.5 or higher installed. But I don't want the user to have to install .Net, especially an older version.
For example, if the user is on Windows 10, they'll have .Net 4.5 installed by default.
Is there any way to deploy an application that will use a baseline version of .Net or higher. Or do I have to make separate builds and serve them to the right users?
Upvotes: 0
Views: 93
Reputation: 2852
Adoring to Microsoft website. Apps written and eployed in 3.5 and lower will run in .NET 4.5 without issues or needing 3.5 to be installed. You may have to do a bit more investigating about other versions of the framework.
Upvotes: 0
Reputation: 21887
According to the Version Compatibility in the .NET Framework
guide (emphasis mine):
By default, an app runs on the version of the .NET Framework that it was built for. If that version is not present and the app configuration file does not define supported versions, a .NET Framework initialization error may occur. In this case, the attempt to run the app will fail. To define the specific versions on which your app runs, add one or more elements to your app's configuration file. Each element lists a supported version of the runtime, with the first specifying the most preferred version and the last specifying the least preferred version.
with the supported runtime config being something like:
<configuration>
<startup>
<supportedRuntime version="v4.0"/> <!--.NET 4.5 -->
<supportedRuntime version="v2.0.50727"/> <!-- .NET 3.5 -->
</startup>
</configuration>
Also anything that is targeting .NET 3.5 will be compatible with the .NET 4/4.5 runtime (from the same article linked above):
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.
Upvotes: 2