Further Thoughts on Adopting .NET Framework 3.5 and VS 2008

Published 27 November 07 04:07 PM | cjlotz

In my current role as .NET technology consultant I am trying to do all the pre-work required to get the .NET Framework 3.5 and VS 2008 adopted as the .NET development standard for our company going forward.  Here are some useful resources that I have come across that I would like to share with other teams that need to do the same thing in their corporate environments.

Coding Standards

Our existing coding standards is based on C# 2.0 and Visual Studio 2005.  I have now updated it to include support for C# 3.0 and Visual Studio 2008.  I used the following resources:

  1. IDesign C# Coding Standard: Guidelines and Best Practices Version 2.32 - The IDesign folks have updated their coding standard to support the new C# 3.0 language features.  If you have no coding standard at all smile_cry, this is an excellent document to use as reference.  Also be sure to check out their WCF Coding Standards.
  2. Extension Methods Best Practices - Even though we only use C#, I came across this excellent post by The VBTeam that nicely summarizes extension method best practices.

My changes included adding some formatting standards for Lambda expressions and LINQ queries; a recommendation for the use of automatic properties for simple properties and a section on the best practices for making use of extension methods.

VS 2008

There has been a lot of improvements to the Visual Studio 2008 IDE.  One of my favourite features is the new multi-targeting support that allows teams to use VS 2008 but still target the .NET Framework 2.0 as deployment platform. 

Moving onto VS 2008 gives a team all the benefits like improved compile times, better performance analysis, improved code metrics and code analysis etc.  It also positions a team better to take future advantage of the new C# Language and .NET Framework improvements.  As the VS 2008 project file format is backwards compatible with VS 2005, it leaves a team with a fallback position should anything drastically go wrong with VS 2008.

However, when making the move, please take the following into account:

  1. The VS 2008 .sln file format is not compatible with the VS 2005 .sln file. You will therefore have to create a separate .sln file to support VS 2005 development.  This is typically a 5-minute exercise.
  2. If you are only targeting .NET 2.0, install only VS 2005 on your build server to catch out the scenarios where somebody has inadvertently started using some of the new language features. A concern I have here is that installing VS 2008 will also install .NET 2.0 SP1. You may therefore run into scenarios where things work in your local VS 2008 developer sandbox but not on the build server.  Highly unlikely, but still something to consider.  I haven't checked, but do you have to install .NET 3.5 on the server just to get NET 2.0 SP1 or is it available as a separate download? I don't like the idea of making .NET 3.5 a pre-requisite just to get .NET 2.0 SP1 installed.
  3. Ensure that all your existing add-ins and control libraries have been upgraded to run in VS 2008.  See the tips for using ReSharper.
  4. If you are using Visual SourceSafe 2005 together with Visual Studio 2008, there seems to be a minor glitch that can be corrected by following the steps detailed in this blog post. The problem does not seem to apply to Visual SourceSafe 6.0d as it works fine against VS 2008.

Hope you find the information useful! smile_regular

Filed under: ,

Comments

# Craig Nicholson said on November 27, 2007 09:17 PM:

If you are targeting only .NET 2.0 you might want to stick to using VS2008 and Code Analysis as part of your build process. Check out this cool post from Krzysztof Cwalina about checking for multi-targeting issues (blogs.msdn.com/.../Multi_2D00_TargetingAndFxCop.aspx).

# cjlotz said on November 28, 2007 10:31 AM:

Also see the following tips:

1. To get web application projects working in both VS 2005 and VS 2008: stevenharman.net/.../multi-targeting-vs2005-and-vs2008-web-application-projects-a-gotcha.aspx

2. To get around the MSBuildToolPath property that is only available in VS 2008: feeds.feedburner.com/.../running-vs2008-amp-vs-2005-side-by-side-project-file-difference.aspx

3. To turn off ReSharper code analysis for a single file: feeds.feedburner.com/.../temporarily-disable-code-analysis-for-single-code-file-with-resharper-3-0-2-and-vs-2008.aspx

# Willie Roberts said on November 28, 2007 01:28 PM:

For the record you can download Framework 2.0 SP1 seperatly. It is on the MS Downloads site has Framework 2.0 with SP1 and doesn't come up immediatly in a Google Search. I found a blog pointing to it eventually and downloaded it from there.

# cjlotz said on November 29, 2007 11:28 AM:

Also see Scott Guthrie's advice on VS 2005 add-ins that may not work in VS 2008 : weblogs.asp.net/.../vs-2008-compatibility-with-older-vs-2005-add-in-packages.aspx

# ahmeds said on November 29, 2007 06:37 PM:

Talking about iDesign, Juval Lowy is actually in SA right now. I have been attending his course this week - intense is the way to describe it

Also you can get .NET 2.0 SP1 from www.microsoft.com/.../details.aspx. It is a prereq for 3.5 but not the other way around

# cjlotz said on December 4, 2007 10:52 AM:

Also see the excellent Visual Studio 2008 and .NET Framework 3.5 Training kit for getting your developers up to speed with the new technology.

www.microsoft.com/.../details.aspx

# cjlotz said on December 6, 2007 09:40 AM:

On the topic of only installing VS 2005 on the build server when targeting .NET 2.0:  

MSBuild allows you to specify a TargetFrameworkVersion property by which you can force compiler errors to be generated for code that are using features not supported by the specific version of the .NET Framework, i.e. if you create an application with some LINQ queries, the following creates compile errors:

msbuild ConsoleApplication1.csproj /ToolsVersion:3.5 /p:TargetFrameworkVersion=v2.0 OR

msbuild ConsoleApplication1.csproj /ToolsVersion:3.5 /p:TargetFrameworkVersion=v3.0

However, the following compiles successfully.

msbuild ConsoleApplication1.csproj /ToolsVersion:3.5 /p:TargetFrameworkVersion=v3.5

This allows me to take advantage of the new improved build features like parallel builds in MSBuild 3.5 and still prevent 3.5 features from slipping through .NET 2.0 deployment builds.

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: