Framework Targeting with Orcas

Posted Friday, June 1, 2007 9:21 AM by C-Dog's .NET Tip of the Day

One of the feature in Orcas that I mentioned yesterday was the ability to target which version of the .NET Framework it compiles to. Although technically 3.0 and 3.5 are just extensions to 2.0, Orcas gives you the ability to select which one to target. By doing so it filters out project types and things you can't do if you are using a lower version of the framework. For example, it won't compile LINQ statements if you have 2.0 selected.

Since this is the first version that truly allowed framework targeting (technically you can get VS2005 to target 1.1 and 1.0 but its not ideal), I had to give it a try. I needed to compile the Ajax Control Toolkit, so I thought this would be the perfect opportunity to try it out. The first thing I noticed is when I opened the solution it popped open the familiar solution migration wizard. I thought this was odd but then on the next step it pointed out that 2.0 projects would not be converted. So basically it just converted the solution file to a different format.

Once the project was loaded, I built the solution. It compiled just fine. I took my compiled AjaxControlToolkit.dll and copies it to the VM that I needed it on (which didn't have the 3.5 framework or anything) and it worked just fine.

For new projects there is a drop down list on the new project dialog to choose the framework. For an existing project, you can also still change the target framework by going to the properties of that project. On the application tab as shown below, you will see a new drop down list to choose the framework.

Target Framework DropDownList

So far I am pretty impressed. What this means if that I can use Orcas to work on my 2.0 projects today even though I won't be using 3.5 framework features. The benefit is I get to use the improved designer and I have cool things lke JavaScript IntelliSense. If things don't work out when I am using Orcas, I can always switch back to VS2005 which coexists just fine.

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=363