1. Back To Blog

C# and .NET Framework interview questions:- Describe Multi-targeting in .NET?

Multi-targeting: - Multi-targeting is the ability to specify the version of the .NET Framework that your application requires to run and have the matching experience while developing it with Visual Studio's Integrated Development Environment (IDE).

Visual Studio 2010 multi-targeting enables you to take advantage of the latest enhancements to Visual Studio without having to upgrade Web sites or Web services to the latest version of the .NET Framework. This lets you use Visual Studio 2010 to maintain and develop your Web applications that use earlier versions of the .NET Framework.

Let's see a small demonstration on Multi-targeting.

Create a new project as following diagrams.



As you can see that we have selected ASP.NET Web Application which is targeting the .NET Framework 4.0 with this project, Visual Studio 2010 will automatically filter the toolbox controls and all the properties which are supported in .NET framework 4.0.

Now, let's see which are the toolbox controls and the properties are available while selecting the .NET Framework 4.0.


Similarly, let's see when we add reference what the version is been used currently.





As you can see in the above diagram the current version is 4.

Now, let's see how we change the .NET Framework 4.0 to 2.0.




As soon as you click on properties a new window will open like below window from that select the .NET Framework to 2.0.








As soon as you change the .NET Framework to 2.0, Visual Studio 2010 will automatically filter the toolbox controls and shows only those controls that are shipped in .NET Framework 2.0.





As you can see that few of the control are not available now in the toolbox as we have seen in .NET Framework 4.0 toolbox.

Similarly, let's see what happen when add reference.






Now, you can see that the current version used is 2.

So, multi-targeting enables you to take advantage of the latest enhancements to Visual Studio without having to upgrade Web sites or Web services to the latest version of the .NET Framework.
 
Following is the video on different kind of questions that are asked in C# and .NET interviews: -


Shiv Prasad Koirala

Visit us @ www.questpond.com or call us at 022-66752917... read more

We are on Social