To get a better understanding of how these new
multi-targeting features work, let’s create a new ASP.NET Web Application using
VS 2010. To-do this we can use the “File->New Project” menu command to
bring up the “New Project” dialog. We’ll use the version drop-down at the
top of the dialog to filter the project templates to only show those supported
with .NET 2.0. We’ll then create a new ASP.NET 2.0 web application
project:
Figure 1
Because we are targeting .NET 2.0 with this project, VS 2010
will automatically filter the toolbox and markup intellisense to only allow us
to use those controls that shipped in ASP.NET 2.0. Unlike VS 2008, the VS
2010 property grid now automatically filters to only show those properties that
were supported on the ASP.NET 2.0 button control:
Figure 2
When writing code, VS 2010 will also now only show code
intellisense for those types and methods/properties/events supported with .NET
2.0. Below you can see intellisense for the ASP.NET 2.0 “Response” object
when we type “Response.Re”:
Figure 3
When we run the application using the built-in VS
web-server, it will run using the ASP.NET 2.0 version (and the VS 2010 debugger
will debug the CLR 2.0 process):
Figure 4