What is and what is the Target Framework server for?

11

I worked for some time with .NET and was asked about the target framework of my projects.

I understand what it is for but I did not know how to explain it in a simple and clear way exactly what it is.

    
asked by anonymous 08.08.2017 / 16:14

3 answers

15

Examples:

.NET Framework 2.0: You will have the features present in .NET version 2.0 and on the "client" computers, you will need to have .NET 2.0 installed.

.NET Framework 4.6.1: You will have the features present in .NET version 4.6.1 and on the "client" computers, you will need to have .NET 4.6.1 installed.

If you are working with LINQ for example, this feature is only available from .NET version 3.5, in earlier versions, you can not develop using LINQ. There are several other features that are inserted or discontinued with each update, usually maintaining backward compatibility. I believe that the ideal is always to prefer the most current ones, unless you have a specific requirement.

Situations that happen when you publish an app:

1 - Develop with .NET 2.0 and run on a Windows XP SP2 machine < Windows 8: Application Runs natively, since these S.O. already have the framework installed.

On Windows 8 or higher machines, you will need to install the .Net 2.0 and 3.5 package from the control panel > add or remove features from windows.

2 - Developing with .NET 4 , to run on older versions of windows, it will be necessary to install the package by the installer published by microsoft, verifying compatibility with the OS In the most current versions (8 to 10) a application will run natively.

    
08.08.2017 / 16:28
12

There are several versions of frameworks as seen on the screen. In fact there are many more than these, since there is not only the .NET Framework, there is, .NET Core, .NET Native, Xamarin, Mono, .NET Micro Framework, among others. Of course you can only use what is installed on your machine. Of course in the case of the .NET Framework this is more important because it functions as a complete platform and needs to be installed on the user's machine.

At the moment you are generating the binaries for your application, it is important to indicate which version you want to use for it to configure everything correctly and to analyze if you can sweat everything you want. So if you indicate that you will use an older version, you will not have access to the features of the newer versions. If you indicate that you will be using a newer version, your application will only run on machines that have that version of .NET, even if you have not used anything specific to it. Of course, the appropriate installer will make the .NET upgrade for you if needed.

If I'm not mistaken, version 3.5 is still officially supported, the former exist for compatibility. I always prefer the most current version of 4.7.

    
08.08.2017 / 17:04
7
  

When you target the framework in an app or library, you are specifying the set of APIs that you would like to make available to the app or library. You specify the target framework in your project file using Target Framework Monikers (TFMs).

From what I understood in that link if you understand a little English, is that the target framework "points" to which version your app or library will be available (compatibility). This includes programming language capabilities and development patterns

    
08.08.2017 / 16:21