Are you thinking what I'm thinking?

David Jung's journey through Visual Studio, Team Foundation Server, and this thing called Application Lifecycle Management

VS2008 and Multi-Target Frameworks

VS2008 and Multi-Target Frameworks

  • Comments 1

One of the great things about Visual Studio 2008 is it's ability to work multiple .NET Frameworks (.NET 2.0, 3.0, and 3.5 to be exact). Unfortunately, .NET 1.0 and 1.1 developers will still need to have Visual Studio .NET 2002 and Visual Studio .NET 2003 installed, respectively, in order to continue to develop solutions built on those frameworks.

By allowing VS 2008 to work with multiple framework, you can take advantage of all the new IDE features with which ever framework you're working with. For VB.NET developers, the new feature of Intellisense everywhere is quite handy and it's not as annoying as Office's Clippy saying "Hi David...it looks like you're trying to Dimension a variable, would you like me to help you?" So even though you're working on a .NET 2.0 application, the VB.NET Intellisense is still available to you.

 VB.NET Intellisense

Caveats about multi-target projects

Tales of Two Solutions Files

While having the ability to work with .NET 2.0 and 3.x frameworks within one IDE is great, there are a couple of things you should be aware of -- unless of course you've already run into them.

You can safely open up .NET 2.0, 3.0, and 3.5 projects in VS 2008 without having to upgrade them like you had to past VS versions. However, if you open up the solution file, there will be some modifications made to it to work properly with VS 2008. If you have developers still working with VS 2005 and others with VS 2008, you should create two solutions files; otherwise, if a VS 2005 IDE opens a VS 2008 solution file, you will get the following error dialog:

Opening a VS2008 Solution file in VS2005

So the way around this would be to have two (2) solutions files -- one in VS2005 format and another in VS2008 format -- and have them in your source control tool.

Kick It (the Framework) Up a Notch!

So you got word that you can use .NET 3.5 in your application because you want to take advantage of LINQ (Language INtegrated Query). So you change the Target Framework setting to ".NET Framework 3.5" in the project's Properties window and Bam! instant upgrade. Well, not exactly. It does change the project to reference .NET 3.5. It adds a new reference to System.Core and all the .NET 3.5 features are available in the New Item Aggregator like User Control (WPF) and LINQ to SQL Classes; however, if you try using LINQ right away (say to go after XML or Object information), one thing is missing which is the reference to System.XML.LINQ. Now if you add a LINQ to SQL Class to your project, the reference will be added automatically. It's no big deal to add it yourself and having it added when you add a LINQ to SQL Class, but since we're say that LINQ is such an important technology that we're adding it all new projects, I'm not sure why we missed adding this reference when stepped up the solution?

Find Your Target (Framework)

Depending on which .NET language you're developing in, finding the Target Framework setting can be a bit challenging if you're not careful. That's because the setting is not in the same place for C# and VB.NET projects. For C# projects, once you open the Property tabs, it's on the first tab, which is the Application tab. For VB.NET projects, it's buried a bit. Under the Properties, select the Compile Tab and then the Application Compile Options at the bottom of the form. That will bring up the Advanced Compile Options dialog box where you can fin the setting.

CS_TargetFX

C# Target Framework Location

vb_targetfx

VB.NET Target Framework Location

Excelsior!

Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post