Channel Daily News

Visual Studio 2008 advances with few missteps

Microsoft Visual Studio 2008 (VS08) is the current incarnation of the company’s long line of IDEs. It’s the premier IDE for developing applications with the Microsoft .Net Framework and, at least, a contender for the best Windows-hosted C/C++ IDE. Of course, Visual Studio 2008 isn’t limited to developing desktop applications; it is also good for developing Web, SOA, and device applications. This release introduces support for .Net Framework 3.5, and it supports other versions of the .Net Framework as well. It also introduces Language-Integrated Query, a generic way to query all kinds of data in C# and Visual Basic, and full support for Windows Vista, Silverlight, and Windows Presentation Foundation.

VS08 comes in a range of editions, from the free Express Editions to the $10,000 does-everything Visual Studio Team System 2008 Team Suite. Basically, the Express editions are for beginner, student, and hobbyist developers; Standard Edition is for individual developers; Professional Edition is for advanced developers and those who work in small teams.

Team System is primarily for larger teams. There are Team System clients for developers, architects, DBAs, and testers, as well as a combined client for all roles called Team Suite. The server for Team System is Team Foundation Server (TFS), which combines a team portal, version control, work item tracking, build management, process guidance, and business intelligence.

In this review, I’ll concentrate on the features of VS08 Professional Edition, and touch on a few of the highlights of Team Suite. I won’t try to discuss Team Foundation Server as such, although it has received numerous enhancements, such as a new team build system and Web access, since we last reviewed it.

Installation and testing

For review purposes, I used three installations of VS08: Professional Edition installed on a Windows Vista for x64 laptop along with Expression Web and Expression Blend; Team Suite installed on a Windows XP desktop along with Visual Studio 2005 (VS05), without access to TFS; and Team Suite installed in a Windows Server 2003 Virtual PC along with TFS. Ninety-day trial versions of all of these versions are available from Microsoft’s Web site.

I have blogged at some length about my trials and travails installing Team Suite. None of that should affect you, unless you try to uninstall VS08 from a machine that also has VS05; nevertheless, making an image backup of your system before you start your installation might be wise. Expect a VS08 installation to take several hours, with one manual intervention required to start the documentation installation step.

I ran the VS08 Team Suite on my XP desktop almost all day, five days a week for several weeks, and tried to use it for all my development work. I also ran through a number of individual development scenarios with the Professional Edition on the Vista laptop, and simulated a few group development scenarios on the Team Suite/TFS virtual PC. One caution: If you install on Windows Vista with User Account Control (UAC) enabled, be prepared to run VS08 as Administrator a few times until all the required directories have been created; after that, it should be fully UAC-compliant.

Introducing .Net Framework 3.5

VS08 is the first version of Visual Studio to support .Net Framework 3.5. It is also the first to target multiple versions of .Net Framework (2.0, 3.0, and 3.5). Previous versions of Visual Studio supported only one version of .Net Framework, forcing developers to either maintain multiple versions of Visual Studio or to upgrade all their projects to the current version of .Net Framework. Multi-targeting is a welcome enhancement; it is included in Standard Edition and above.

I wish Microsoft had gone a little further in this direction. It’s too bad that Microsoft didn’t also provide targeting for .Net Framework 1.1 and easy bidirectional conversion between VS08, VS05, and Visual Studio .Net 2003 projects.

.Net Framework 3.5 has a number of new class library and language features. These include Language-Integrated Query (LINQ), Web 2.0 and SOA-related enhancements, integrated workflow, peer-to-peer protocols, and Microsoft Office support.

The tooling for all of these is found in VS08. So, for example, VS08 Standard and above have LINQ support in Visual Basic .Net and Visual C#, including an Object Relational Designer, the SQLMetal command-line tool, LINQ-aware code editors, and debugger support.

Language-integrated queries with LINQ

LINQ is a generic mechanism with many possible components. LINQ brings data queries into the C# and Visual Basic languages, and makes the syntax for queries against in-memory data structures just like queries against file systems, XML files, and SQL databases.

Several of the LINQ components and providers shipped in VS08, including LINQ to Objects (strings, reflection, and file directories), LINQ to XML, and LINQ to ADO.Net. LINQ to ADO.Net includes two components: LINQ to DataSet and LINQ to SQL. The more ambitious ADO.Net Entity Framework and LINQ to Entities are not included in VS08, but may ship later this year as an add-on.

I tested LINQ to SQL in C# against a SQL Server 2000 database. The object-relational diagram in this screen image was automatically generated by dragging the tables from a database. A set of callable, LINQ-compliant classes was automatically generated as well.

The Object Relational Designer worked well to create C# classes from the database schema, and IntelliSense worked well when I was writing LINQ queries. On the other hand, writing LINQ queries by hand against three related tables pushed the limits of my nascent LINQ skills, and I longed for the LINQ equivalent of VS08’s graphical SQL Query Designer. I never did figure out how to write the LINQ equivalent of a SQL “SELECT DISTINCT” query.

IntelliSense, refactoring, unit testing, and metrics

When I was working on this small project, I found that the C# refactoring functionality (included in Professional and above) worked well and quite smoothly. When editing C#, the programmer can take advantage of automated refactoring, as shown in the popup menu of this screen image. There is full IntelliSense support for LINQ (see the code that starts with “var qAV” in the figure). Code metrics (at the bottom of the figure) are calculated only for managed code.

I also found that the code metrics for managed code (included in VSTS Developer and Team Suite) worked fairly well. I’m not sure that I agree with the way the metrics are calculated for code generated from design surfaces, but I can certainly see the overall utility of the metrics, especially in the context of team projects managed with TFS.

I used metrics such as cyclomatic complexity (a measure of the number of linearly independent paths through a program module) years ago to help me manage a large C project with a dozen programmers. I’m happy to see this technology introduced in VS08 for managed code.

I’m disappointed, however, that code metrics and code refactoring are not available for unmanaged C++ projects. On the other hand, C++ projects can use a very nice call browser: It gives you a compact view of the other functions that call a given function, and of the lines of code that do the calls.

I’m happy that Visual Basic projects have code metrics along with an incredibly concise syntax, great IntelliSense, and many code snippets. I’m disappointed that Visual Basic projects don’t have code refactoring, although this functionality can be added using one of several third-party plug-ins.

I’m delighted to report that unit testing is now a feature of the Professional Edition. (It was a VSTS feature in VS05.) You can create unit tests and test projects for C#, Visual Basic, and managed C++ solutions. It was possible to do this before using the free open source program NUnit, but it’s a little nicer having the unit test capability integrated with the IDE.

IntelliSense for JavaScript was one of the promised improvements in VS08. It’s there, but at a cost: Although support for the sort of JavaScript used to write ASP.Net AJAX and Silverlight pages has been added, support for editing VBScript and Classic ASP has been dropped. As I am still maintaining a 1999 vintage Classic ASP site, I was more than a little annoyed to find that VS08 did a worse job with ASP pages than VS05, or indeed than Visual InterDev 6. Microsoft is considering restoring this functionality for a service pack to VS08. Meanwhile, people who still maintain Classic ASP sites should not abandon their existing tools.

WPF, Silverlight, and Web 2.0

VS08 supports Windows Presentation Framework (WPF) with a split-pane WPF designer, debugger support, and WPF project templates for C# and Visual Basic. WPF “supports UI, media, documents, hardware acceleration, vector graphics, scalability to different form factors, interactive data visualization, and superior content readability,” according to Microsoft. WPF graphics are defined by XAML, an extension of XML. The split-pane WPF designer uses a GUI in one pane and XAML in the other, and synchronizes the two bidirectionally as long as you don’t introduce errors into the XAML.

VS08 supports Silverlight, a rich Internet application technology that includes a subset of WPF, once you install the Silverlight SDK and the Silverlight Tools for VS08. I had good experiences developing Silverlight applications with a beta version of VS08.

With the exception of the dropped support for VBScript and Classic ASP, the Web page design surface in VS08 is better than that of VS05; it’s very similar to Expression Web, and supports CSS nicely. Design surfaces and projects for ASP.Net AJAX, Windows Communications Foundation and Windows Workflow Foundation, which were free add-ons to VS05, have moved to the base VS08 product.

>b>Office and Smart Device targets

Visual Studio Tools for Office (VSTO) has been merged into the VS08 Professional Edition and above; it was previously a separate $799 product. VSTO now supports all the components of both Office 2007 and Office 2003 in both C# and Visual Basic.

VS08 can create managed Smart Device project for four target platforms and two versions of the .Net Compact Framework in C# and Visual Basic. In C++, VS08 can create unmanaged Smart Device projects using Win32, ATL (Active Template Library), and MFC (Microsoft Foundation Class) libraries; that capability used to be in a separate Windows CE toolkit.

Odds and ends

ClickOnce deployment has been enhanced to cover WPF Web Browser applications. It has also been enhanced to allow ISVs to re-sign the application manifest, and to generate manifests under UAC. ClickOnce is a lighter-weight alternative to Microsoft Installer that lets self-updating desktop applications deploy from a Web site.

Microsoft SQL Server Compact 3.5 is a new local database that is small enough to deploy on smart devices. Developers can use it both in stand-alone and occasionally connected scenarios. When SQL Server Compact is used for local database caching, Microsoft Synchronization Services for ADO.Net takes care of periodic synchronization between the local Compact database and the remote database.

If a Team Foundation Server installation is detected, Visual Studio can integrate with it. This allows a programmer to receive work items and do check-ins, and a manager to produce reports.

Team System has a number of improvements. One big item in TFS is a new Team Build system; another is Web access. Architects have a new top-down system designer and an architectural role system. Developers have the new code metrics system I discussed earlier, as well as better code analysis and performance tools. DBAs have T-SQL code analysis, a data generator, and refactoring tools. Testers have better tools and validation rules, including a Test Load Agent.

Visual Studio has an active ecosystem of independent software vendors. Most of these vendors produce plug-ins and controls that enhance Visual Studio. A new Visual Studio Shell lets these vendors ship stand-alone versions of their products that do not require the customer to buy Visual Studio proper. I applaud this move by Microsoft: I think it makes the ecosystem healthier because it allows the ISVs to be more competitive at a relatively small cost to Microsoft.

Overall, Visual Studio 2008 is an upgrade that most Microsoft-oriented development shops will want to make, in order to develop with new technologies, such as WPF, WCF, and WF, and for new platforms, such as Windows Vista. However, it’s not an upgrade that’s easily made piecemeal; I’d advise most shops to upgrade all developers on a project once the project itself has been successfully upgraded. In my experience, upgrading projects from VS05 to VS08 has been relatively painless, involving very little in the way of code rewrites.

For shops that still maintain Classic ASP sites, I’d recommend installing VS08 side by side with VS05, at least until Classic ASP and VBScript editing functionality has been restored. And for shops that still use Visual Studio .Net 2003 or older versions because of perceived problems with VS05, I’d suggest seriously evaluating VS08.

With few exceptions, users of every level of Visual Studio will find the 2008 release improved. It’s a strong upgrade, and a solid foundation for future development.