Different Versions of Integrated Web Server in Visual Studio 2010

While running your ASP.NET application, you must have seen, it is running on Integrated Web development environment. Visual Studio 2010 comes with two versions of Integrated Web Development environment which could run side by side. In case you run your ASP.NET application in VS 2010, you can have an option to choose between the two versions of Web Development environment, one running CLR 2.0, which was there before VS2010 and a new version of Web Dev with CLR 4.0. Multi – targeting allows you to configure your Visual Studio to run more than one Web Dev server at a time, one using CLR 2.0 and another using CLR 4.0

In one of my ASP.NET Online sessions, I had talked about the multi targeting features of Visual Studio 2010 for web development. During the demo I have shown, how can we target two different versions of .NET CLR version at the same time. Some of the attendees had some doubts on that. So in this blog post, I am going to explain how we can target two different versions of CLR at the same time.

To demonstrate it, start with a new Visual Studio Instance, and create a solution file which contains two different Framework versions of web applications. Let’s say there are two web applications which are targeted to ASP.NET 3.5 and ASP.NET 4.0 version.

1 2

Below is the structure of your solution files which contains two different projects of different Framework versions.

3

Now, if you run these two applications individually, for .NET 3.5 (ASP3_5Apps), you will see it is targeting CLR Version 2.0.

target35

And if you set 4.0 project as the startup project, you will see the ASP.NET 4.0 application is targeting CLR Version 4.0.

target40

Now, we can see that individually two different applications targeting two different frameworks. Now let’s have a look, if we run these two different framework applications at the same time. To set multiple projects as start up project, right click on Solution and Go To Properties and select the option for multiple startup project. You can read my blog post How to setup multiple startup projects in Visual Studio? for more details.

multiplestartup

Click on Apply and Ok. And run the application. You will find that both applications run at the same time and both of them target two different framework versions.

two

Yes, they are targeting to two different frameworks at the same time. This is really helpful, for backward compatibility, like say, your services running on .NET 2.0 version and you are developing a frontend application using .NET 4.0.

If you are hosting the Visual Studio application in IIS, VS 2010 will correctly update the application pool ASP.NET version based on the selected framework from Visual Studio.

targetiis targetiisff

Summary

In this post, I have explained how you can use a different version of Integrated ASP.NET engine to run ASP.NET application with in VS 2010 along with targeting different CLR version (CLR 2 and CLR 4) at the same time. I have also explained side by side execution of different framework versions of ASP.NET application.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.