Using Visual Studio 2010 multi-targeting along with older versions

One question I have seen asked a few times is “Can I use Visual Studio 2010 to develop .NET 2.0 applications with developers using Visual Studio 2005 or 2008?”. As with all questions of possibility, the true answer is yes, but it comes with a caveat. The thought is that you simply home the projects to an older version of the framework and everything is handled for you. Here are a few issues you have to consider in the mix.

Problem #1: Solution and Project files

This problem is solved by having two sets of files: One for Visual Studio 2010, the other for the older version. The reason for this is simple. The new file formats ARE NOT compatible with older versions of Visual Studio. This has been an ongoing issue. It would be nice if they merely added to the schema and made it so the older version ignored the bits it did not understand, but that was not envisioned (and rightfully so, considering the vast number of changes in .NET since 1.x).

There is still a big issue to overcome here. When you add or delete files, only one “platform” has the changes. The other just ends up with code that breaks. This puts the onus on the developer to fix the older version any time something is added, or vice versa.

Problem #2: Code Syntax Changes

This has been the bigger issue in my tests. Despite homing to .NET 2.0, I have found that Visual Studio 2010 allows you to use newer syntax against the older framework. This is not true when using the Framework classes directly, unless there are some “fixes” to 2.0 classes in the .NET Framework 4.0 (I have not found any, but I have not looked at the docs for Framework changes yet). One example I found was using simple Property syntax:

public int MerchantId { get; set; }
public string DBAName { get; set; }

When this is taken back in Visual Studio 2005 on my work computer, I have to edit each of these to this format:

private int _merchantId;
private string _DBAName;

public int MerchantId
    get { return _merchantId; }
    set { _merchantId = value; }

public string DBAName
    get { return _DBAName; }
    set { _DBAName= value; }

Not a huge deal, as you can use the long syntax (yes, it means more typing), but it is something to take into account. The Visual Studio 2010 version compiles to a perfect 2.0 assembly (ie, the application works), but if someone is using Visual Studio 2005, you have to take syntax into account if you are trying to use Visual Studio 2010 to code along side.

Problem 3: Deprecation (Potential Problem)

This is the inverse of the problem with Visual Studio 2010 new syntax. I have not yet run into this problem, so I am not sure it exists. But there is a potential of a deprecated bit of syntax being removed from Visual Studio 2010. If syntax has been deprecated, the devs with the older version must refrain from its use or you will not be able to compile.


Yes, you can use Visual Studio 2010 alongside developers with older versions, if you need to play this way. But, no, I would not recommend it, unless you really are aware of the difference between the framework versions and language syntax changes to remember to use the older syntax.

I wholeheartedly recommend playing with Visual Studio 2010. There are a few new annoyances I have found (more about this later), but the overall experience is great. It runs faster than 2005 or 2008, at least in my experience, and the productivity additions to the coding surface are a great help (my fave so far being the ability to type in the middle part of a variable I have forgotten the name of and have it find the variable – The reason for “forgetting” is the lack of good coding standards here).

Peace and Grace,

Twitter: @gbworld
Miranda’s Christmas Story (vote daily):


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: