VisualStudioMagazine.com

PLUS Product Review: Visual Studio 2010 What’s New in Visual Basic 2010 JUNE 2010 Volume 20, No. 6 Volume Untitled-5 2 3/5/10 10:19 AM Sure, Visual Studio 2010 has a lot of great functionality— we’re excited that it’s only making our User Interface components even better! We’re here to help you go beyond what Visual Studio 2010 gives you so you can create Killer Apps quickly, easily and without breaking a sweat! Go to infragistics.com/beyondthebox today to expand your toolbox with the fastest, best-performing and most powerful UI controls available. You’ll be surprised by your own strength!

Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91-80-6785-1111 twitter.com/infragistics

Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics and the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc.

Untitled-5 3 3/5/10 10:19 AM  ,7·6(9(5<:+(5( 

&RGH,W·VXVHGWRFUHDWHWKHWKLQJVWKDWDUHDOODURXQGXV $OPRVWHYHU\ZKHUH\RXORRNLW·VWKHUH-XVWOLNHWKHSRVVLELOLWLHV \RXVHHDVDGHYHORSHU:LWK9LVXDO6WXGLR\RXFDQUHDOL]H \RXUYLVLRQZLWKQHZWRROVWKDWZLOOGUDPDWLFDOO\LPSDFWWKHZD\ \RXZRUNIURPGHVLJQWRGHYHORSPHQWWRGHSOR\PHQW  /,)(581621&2'( :+$7:,//<28'2:,7+9,68$/678',2"

*HWVWDUWHGDW9LVXDO6WXGLRFRP

S N A P I T >6QDSWKLVWDJWRJHWWKHODWHVWQHZVRQ9LVXDO6WXGLRRU7H[W96WR @ *HWWKHIUHHDSSIRU\RXUSKRQHDWKWWSJHWWDJPREL 6WDQGDUGPHVVDJLQJDQGGDWDFKDUJHVDSSO\

Untitled-1 1 3/25/10 10:39 AM { FRAMEWORKS }

12

Michael Desmond, Editor in Chief, Visual Studio Magazine A Seat at the SharePoint Table Stop me if you’ve heard this one before. takes a popular application, builds it out into a platform, then refi nes and extends the opportunities for developers to code against it. We’ve seen this pattern with Windows, we’ve seen it with Offi ce, and we’ve seen it most dramatically with SharePoint, which has exploded as a target for development despite what seemed like the best eff orts of Microsoft to the contrary. Lacking integrated tooling in Visual June 2010 // Volume 20 // No. 6 Studio, SharePoint 2007 developers turned to third-party software and the FEATURES fl awed Microsoft Visual Studio Extensions for Windows SharePoint Server. 12 Office Alignment Still, huge barriers remained, such as Why Office 2010 and SharePoint 2010 are poised to unleash the requirement that coding be done in a new wave of developer innovation. the server environment—a sticky BY MICHAEL DESMOND prerequisite that required painful workarounds. Developers also struggled 22 Native Development with Visual Studio 2010 with the Collaborative Application Markup New and native support for resources like the Ribbon UI, the Windows 7 Language (CAML) for querying data from Taskbar and parallelism boost native development in Visual C++ 2010. SharePoint lists and extending site function- BY MARIAN LUPARU ality. And coders lacked important resources like source code control and testing facilities. 32 LANGUAGE LAB If this month’s cover feature (“Offi ce On VB PAGE 32 Alignment,” p. 12) is any indication, What’s New in Visual Basic 2010 Microsoft has fi xed all that—and then With the release of Visual Studio 2010 and the .NET Framework 4, some. From native SharePoint project it’s time for Visual Basic developers to start leveraging the templates to full access to the Visual new capabilities of Visual Basic 2010. Studio test and application lifecycle BY JOE KUNK management stack, developers are fi nally equipped with the tools they need to DEPARTMENTS write applications for SharePoint. 6 Letters to the Editor Can we expect a signifi cant surge in SharePoint development following the 8 DevInsight VSTOOLBOX, VSINSIDER new release? Based on my conversations VSToolbox: Upgrading to Visual Studio 2010 PAGE 8 with Microsoft and with SharePoint VSInsider: Raising the Bar PAGE 10 developers, I think so. SharePoint has always 39 Index of Advertisers brought so much to the table. Now, for the fi rst time, developers are getting a seat. What are your plans for developing COLUMNS for SharePoint 2010? E-mail me at [email protected]. 3 Frameworks BY MICHAEL DESMOND

COVER ILLUSTRATION BY RYAN ETTER RYAN BY ILLUSTRATION COVER 40 Redmond Review BY ANDREW J. BRUST

VisualStudioMagazine.com · June 2010 · VISUAL STUDIO MAGAZINE 3 Online Contents

Get the complete picture — the latest dev news, analysis and how-to content—at VisualStudioMagazine.com and our partner sites in the Redmond Developer Network.

EASY FINDIT What we once called FindIT codes are now easy URLs. You’ll see these embedded throughout Visual Studio Magazine so you can access any additional information quickly. Simply type in VisualStudioMagazine.com/ followed by the FindIT code into your URL address field. (Note that all URLs do not have any spaces, and they are not case-sensitive.)

VISUALSTUDIOMAGAZINE.COM REDDEVNEWS.COM ADTMAG.COM

Creating a WCF Data Service Microsoft Releases ADFS 2.0 Tell the Boss to Get Lost BY PETER VOGEL BY JEFFREY SCHWARTZ BY DAVID RAMEL If you want to integrate server-side Web Microsoft has released Active Directory Many companies have tried implementing service processing with AJAX objects in Federation Services (ADFS) 2.0, a key Scrum, and many have failed—but some your browser, you should be considering component of the company’s eff ort to have succeeded. Learn from those who WCF Data Services—especially if you’re provide single sign-on federated identity went before you by checking out some working with the . management across enterprise domains recently posted tips. and to cloud services. VisualStudioMagazine.com/Vogel0610 ADTmag.com/Ramel0610 RedDevNews.com/Schwartz0610 Honoring Startup Requests Microsoft Attacks HTC Android BY KARL E. PETERSON DotNetNuke Update Fixes Bugs BY KURT MACKIE Windows provides numerous ways to tell in Version 5.4 Microsoft and HTC signed a patent deal an application how to size and position BY KATHLEEN RICHARDS involving HTC smartphones running the itself on startup. Have you noticed that DotNetNuke Corp. released version 5.4 of open source Android OS. Microsoft sent your classic Visual Basic apps don’t pay its Web content management framework strong signals that the HTC deal is part of a any attention to how that property is set? to support Microsoft ASP.NET 4. Document larger intellectual property battle, and one Learn how you can honor those requests. management capability was added to the of the targets is the Android mobile OS. Professional and Elite Editions. VisualStudioMagazine.com/Peterson0610 ADTmag.com/Mackie0610 RedDevNews.com/Richards0610A Static Code Analysis Confi guration VMware, Salesforce Partner on Cloud BY MICKEY GOUSSET A New Script for Oracle and .NET BY JOHN K. WATERS By making use of the diff erent static code BY KATHLEEN RICHARDS Virtualization company VMware Inc. and analysis confi guration options in Visual Microsoft is opening up its Visual Studio Software as a Service provider Salesforce.com Studio 2010 Ultimate and Premium editions, 2010 Premium and Ultimate advanced Inc. have joined forces to build VMforce, a you have the ability to fi ne-tune the code database tooling to Oracle Corp. through platform for building and running Java apps analysis engine to perform exactly how you a Quest Software Inc. database schema in the cloud. VMforce combines VMware want it to. This article builds off of a previous provider that can support Oracle 9i -11gr2. vSphere, the SpringSource Java development column on Static Code Analysis in Visual framework and the Force.com cloud- RedDevNews.com/Richards0610B Studio 2010. computing platform.

VisualStudioMagazine.com/Gousset0610 ADTmag.com/Waters0610

VisualStudioMagazine.com RedDevNews.com ADTmag.com

4 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Project3 12/16/09 11:55 AM Page 1 Check out our events at VSLive.com Letters We’ll be at Microsoft HQ & Orlando in 2010 VisualStudioMagazine.com June 2010 • Volume 20 • No. 6

Editorial Staff Vice President, Doug Barney Interpreting Visual C++ Editorial Director The language and improvements outlined in Sumit Kumar’s April 2010 Editor in Chief Michael Desmond Executive Editor Kathleen Richards article, “The Evolution of C++ in Visual Studio 2010,” didn’t alleviate a few readers’ Managing Editor Wendy Gonchar perceptions that C# and Visual Basic will win out at the expense of Visual C++/CLI. Associate Managing Editor Katrina Carrasco Associate Managing Editor Marti Longworth

This release is in fact an attempt by Microsoft [to] try to destroy C++. They want Tools Editor Peter Vogel to force everyone to use the sluggish, interpreted and sick C# and Visual Basic Contributing Editors .NET. It doesn’t work that way. Visual C++/CLI without IntelliSense is garbage. I’d Andrew J. Brust, Ken Cox, Kathleen Dollard, rather stick to my Visual C++ 2008 or move to other C++ compilers and IDEs. Roger Jennings, Jeff Levinson, Bill McCarthy, Karl E. Peterson, Keith Pleas, Bill Wagner, Atoo Dan Wahlin, John K. Waters Submitted via Internet Art Staff Creative Director Scott Shultz There is no word that .NET will be forced upon you while using Visual C++. You’ll Art Director Joshua Gould still be able to use native C++. [Microsoft Foundation Classes] as well as managed Online/Digital Media C++ are optional. This article is about language/library improvements—native C++ Director, Online Media Becky Nagel library and compiler improvements. Executive Editor, New Media Michael Domingo Marcus Site Administrator Shane Lee Submitted via Internet Designer Rodrigo Muñoz Semantics of HTML 5 Andrew Brust’s May 2010 Redmond Review column “The HTML 5 Standard: Innovation or Oxymoron?” got a mixed reaction. President Henry Allain Vice President, Publishing Matt Morollo Director of Marketing Michele Imgrund I have a tough time considering Silverlight when I’ve seen some really great demos Online Marketing Director Tracy Cook of HTML 5. In addition, Silverlight doesn’t work on the iPad or iPhone. I’m sticking with making great Web apps via HTML and [Model-View-Controller] before jumping into Silverlight, which only really works well with Internet Explorer. President & Neal Vitale Sam Chief Executive Offi cer Submitted via Internet Senior Vice President Richard Vitale & Chief Financial Offi cer Executive Vice President Michael J. Valenti What the hell does this mean? “Its enhancements to pure Web applications will impact ASP.NET. But perhaps most importantly, the standards process around Senior Vice President, Abraham M. Langer Audience Development HTML 5 may factionalize the Web and diminish compatibility between IE and the & Digital Media four other major browsers. Increased testing burdens could result, keeping you at Vice President, Christopher M. Coates Finance & Administration work longer or raising your development costs.” Vice President, Erik A. Lindgren HTML 5 is complementary to ASP.NET. IE9 will support HTML 5, and therefore Information Technology & Application Development IE9 will be very compatible with many of the current browsers when it ships. In Vice President, Carmel McDonagh fact, compatibility may even improve thanks to HTML 5. Attendee Marketing Anonymous Vice President, David F. Myers Event Operations Submitted via Internet Chairman of the Board Jeff rey S. Klein Andrew Brust responds: IE9 will support HTML 5. That’s what piqued my interest in it in the fi rst place. The REACHING THE STAFF Staff may be reached via e-mail, telephone, fax, or mail. issue is that the very defi nition of HTML 5 is not hard and fast. Given the WHATWG A list of editors and contact information is also available online versus W3C dynamic—and the lack of consensus it may engender—some browsers at VisualStudioMagazine.com. E-mail: To e-mail any member of the staff , please use the may implement diff erent feature sets from others. Whose will be the “true” HTML 5? following form: [email protected]. I don’t know. But as long as they’re diff erent, it’s an issue and a potential expense. Irvine Offi ce (weekdays, 9:00 a.m. - 5:00 p.m. PT) Telephone 949-265-1520; Fax 949-265-1528 16261 Laguna Canyon Road, Suite 130, Irvine, CA 92618 Visual Studio Magazine wants to hear from you! Send us your thoughts Framingham Offi ce (weekdays, 9:00 a.m. - 5:00 p.m. ET) Telephone 508-875-6644; Fax 508-875-6633 about recent stories, technology updates or whatever’s on your mind. 600 Worcester Road, Suite 204, Framingham, MA 01702 E-mail us at [email protected] and be sure to include your Corporate Offi ce (weekdays, 8:30 a.m. - 5:30 p.m. PT) first and last name, city and state. Please note that letters may be edited Telephone 818-814-5200; Fax 818-734-1522 for form, fit and style. They express the views of the individual authors, and 9201 Oakdale Avenue, Suite 101, Chatsworth, CA 91311 do not necessarily reflect the views of the VSM editors or 1105 Media Inc. Visual Studio Magazine The opinions expressed within the articles and other contents herein do not necessarily express those of the publisher. 6 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Silverlight, .NET, WPF, WCF, WF, C API, C++ Class Lib, COM & more!

Multimedia 'HYHORS\RXUDSSOLFDWLRQZLWKWKHVDPHUREXVWLPDJLQJWHFKQRORJLHVXVHGE\ Microsoft, HP, Sony, Canon, Kodak, GE, Siemens, the US Air Force and Veterans Affairs Hospitals.

/($'722/6 SURYLGHV GHYHORSHUV HDV\ DFFHVV WR GHFDGHV RI expertise in color, grayscale, document, medical, vector and multmedia LPDJLQJ GHYHORSPHQW ,QVWDOO /($'722/6 WR HOLPLQDWH PRQWKV RI UHVHDUFK DQGSURJUDPPLQJWLPHZKLOHPDLQWDLQLQJKLJKOHYHOVRITXDOLW\SHUIRUPDQFH and functionality. Barcode

‡Image Formats & Compression: Supports 150+ image formats and compressions including TIFF, EXIF, PDF, JPEG2000, JBIG and CCITT. ‡Display Controls: ActiveX, COM, Win Forms, Web Forms, WPF and Silverlight. ‡Image Processing:  ¿OWHUV WUDQVIRUPV FRORU FRQYHUVLRQ DQG GUDZLQJ functions supporting region of interest and extended grayscale data. ‡OCR/ICR/OMR: Full page or zonal recognition for multithreaded 32 and 64 bit development. Form Recognition ‡Forms Recognition and Processing: Automatically identify forms and & Processing H[WUDFWXVHU¿OOHGGDWD ‡Barcode:'HWHFWUHDGDQGZULWH'DQG'EDUFRGHVIRUPXOWLWKUHDGHGDQG 64 bit development. ‡Document Cleanup/Preprocessing: 'HVNHZ GHVSHFNOH KROH SXQFK OLQH and border removal, inverted text correction and more. ‡PDF and PDF/A: 5HDG DQG ZULWH VHDUFKDEOH 3') ZLWK WH[W LPDJHV DQG annotations. ‡Annotations: Interactive UI for document mark-up, redaction and image Mark-up measurement (including support for DICOM annotations). ‡Medical Web Viewer Framework: 3OXJLQ HQDEOHG IUDPHZRUN WR TXLFNO\ EXLOGKLJKTXDOLW\IXOOIHDWXUHGZHEEDVHGPHGLFDOLPDJHGHOLYHU\DQGYLHZHU applications. ‡Medical Image Viewer: +LJKOHYHOGLVSOD\FRQWUROZLWKEXLOWLQWRROVIRULPDJH PDUNXSZLQGRZOHYHOPHDVXUHPHQW]RRPSDQFLQHDQG/87PDQLSXODWLRQ ‡DICOM: )XOO VXSSRUW IRU DOO ,2' FODVVHV DQG PRGDOLWLHV GH¿QHG LQ WKH  ',&20VWDQGDUG LQFOXGLQJ(QFDSVXODWHG3')&'$DQG5DZ'DWD  Document ‡PACS Communications: Full support for DICOM messaging and secure FRPPXQLFDWLRQ HQDEOLQJ TXLFN LPSOHPHQWDWLRQ RI DQ\ ',&20 6&8 DQG 6&3 services. ‡JPIP: Client and Server components for interactive streaming of large images DQGDVVRFLDWHGLPDJHGDWDXVLQJWKHPLQLPXPSRVVLEOHEDQGZLGWK ‡Scanning: TWAIN 2.0 and WIA (32 and 64-bit), autodetect optimum driver settings for high speed scanning. ‡DVD: Play, create, convert and burn DVD images. DICOM Medical ‡DVR:3DXVHUHZLQGDQGIDVWIRUZDUGOLYHFDSWXUHDQG8'3RU7&3,3VWUHDPV ‡Multimedia: Capture, play, stream and convert MPEG, AVI, WMV, MP4, MP3, OGG, ISO, DVD and more. ‡Enterprise Development: Includes WCF services and WF activities to create scalable, robust enterprise applications.

+LJK/HYHO'HVLJQ‡/RZ/HYHO&RQWURO

Free 60 Day Evaluation! www.leadtools.com/vsm 866 530-3399

Untitled-1 1 5/3/10 12:54 PM

Visual Studio 2010 Professional

VS Web: microsoft.com/visualstudio Toolbox Phone: 877-696-7786 Price: Upgrade $299; with MSDN Essentials $549; with full Upgrading to Visual Studio 2010 subscription to MSDN $1,199 Is it worth upgrading to the latest version of Visual Studio 2010, even if you’re not Quick Facts: The latest edition of going to move to .NET Framework 4? And if you are upgrading, what will you get? the Microsoft IDE for creating .NET applications adds tooling support for all the features of .NET BY PETER VOGEL are highlighted. This feature isn’t limited to Framework 4 Visual Studio 2008 really did “change the variables—clicking on a method header Pros: Better support for developers game.” You could use the latest version of automatically highlights all the return clauses through effective use of Windows Visual Studio to create applications that ran and the end of the method. But this extra Presentation Foundation, with on earlier versions of the Microsoft .NET highlighting isn’t without a downside. When specific enhancements for virtually Framework. This means that the release of debugging, for instance, I sometimes lost all dev environments Visual Studio 2010 Visual Visual Studio 2010 creates a new question: the current line because its highlighting was Cons: Odd lock ups, some new Does it make sense to upgrade Visual overridden by the highlighting added for features not yet fully integrated Studio even if you’re not upgrading to the currently selected item. .NET 4? The answer is “yes,” and for a lot of IntelliSense also gets a lift and is now reasons. But if you’re going to .NET 4 you’ll “in-string” driven. When declaring a the classes and members that your code find a lot of support in Visual Studio 2010. variable, if you type in “List” you get all of references. In conjunction with TDD, this As soon as you start Visual Studio 2010 the classes with “List” in their name, feature really allows you to create your tests you’ll notice that the Start Page is now more reducing your search time when you can’t ahead of your code. Again, the implemen- useful than the File menu (see Figure 1). remember all of a class name. tation isn’t perfect. For example, generating The Start Page still provides access to members requires that you fiddle with your project templates, but the rest of the page Working with TDD mouse for each member (I’d be interested now provides organized access to training Test-driven development (TDD) is more in a more streamlined process). resources for the major .NET technologies. tightly integrated into Visual Studio. From Also new is the Visual Studio Extension Once you open a file you’ll find that, an edit window’s context menu, you can manager, effectively an apps store for thanks to Windows Presentation Foundation run tests or add a test project to your controls and Visual Studio add-ons. (WPF), there’s more visual feedback in the solution. While not limited to being used Unfortunately, extensions are organized by editing window. For instance, if you click on with TDD, Generate from Usage allows you name or popularity instead of by dev a variable name, all uses of that variable name to write code and have Visual Studio create environment (for example, Silverlight versus ASP.NET). It’s also not obvious if an extension is free until you start to download it.

Supporting .NET 4 Visual Studio 2010 provides dedicated support for specific development environ- ments and .NET 4 technologies. For instance, as parallel processing becomes mainstream with PLINQ, Visual Studio includes enhanced support for debugging multiple threads. The Parallels Task window goes beyond the old Threads window to show individual tasks, even if those tasks are running on the same thread. The Concurrency Visualizer lets you see if you’re successfully distributing your processing loads over the logical cores available on your computer. While middle-tier and service developers may find the parallel processing support Figure 1. The Start Page for Visual Studio 2010 is not only enhanced, it can also be useful, ASP.NET developers will appreciate customized to include company resources. several enhancements. JavaScript IntelliSense

8 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Untitled-3 1 5/24/10 3:29 PM Untitled-3 1 5/24/10 3:29 PM move from 2005 to 2008 was less impres- sive (as most of the changes focused on providing support for .NET 3.5). By comparison, the move from Visual Studio 2008 to Visual Studio 2010 falls in the middle, providing better support for all development activities, specific enhance- ments for each development environment and tooling for new features in .NET 4. If you’re eligible for the upgrade, you should consider the $300 expense not only as an opportunity to get a better IDE, but as an investment in your eventual upgrade to .NET 4—even if you’re not ready for that step just yet. One caveat: In my tests, I was able to open Visual Studio 2008 projects in Visual Studio 2010 and later re-open them Studio 2010 Visual in Visual Studio 2008—but Microsoft isn’t Figure 2. Deploying ASP.NET and SharePoint applications is much simpler under Visual making any promises about round-tripping Studio 2010 than in previous versions. between the two versions. But then, you probably won’t want to. VSM support is enhanced—IntelliSense is no Azure development toolkit. If you’re longer disabled if even one library doesn’t running on SP1 or Peter Vogel ([email protected]) is the Visual compile, for instance. Deployment for ASP. , you’ll be able to Studio Magazine tools editor at and a principal in NET is also much improved. Many ASP. develop and test your cloud applications on PH&V Information Services, specializing in NET applications (both in ASP.NET 3.5 and your local computer. Silverlight 4 developers ASP.NET development. 4) will have the “one-click deployment” that will also need to download a tool package. WinForms apps have had since .NET 2.0. Both WPF and Silverlight developers Config file management is simplified, get new tooling, including designers with ToolTracker which should reduce the number of drag-and-drop support for databinding production sites with their debug option set and for building rich Internet applications. Find more coverage of Visual to True. The config file management also Visual Studio 2010 Professional also Studio tools and solutions online makes creating Windows Communication includes support for Windows 7 develop- at the ToolTracker blog on Foundation (WCF) service creation and ment, including multi-touch and Ribbon VisualStudioMagazine.com. Here’s deployment simpler. UI components. You can create applica- what you’ll fi nd this month: Deployment is also easier for SharePoint tions that support adding items to the • Peter Vogel takes VistaDB out for a developers in Visual Studio 2010. During Windows 7 Taskbar, for instance. spin to see whether a “native .NET development, SharePoint developers will Developers who work in multiple database” gives you the performance find more templates in the Add New Item environments will notice odd differences. you need with the convenience that dialog. Support for creating Windows The Add New Item dialog for Web sites VistaDB promises. Market leader SQL SharePoint packages, deploying/retracting doesn’t categorize the templates, while the Anywhere is also reviewed. solutions and other standard activities— same dialog for Web applications does. It’s • Vogel talks with Oleg Stepanov, a which used to require third-party these little things that make Visual Studio, developer of the JetBrains packages—is now built into Visual Studio. as the British say, “homely.” ReSharper add-in, about keeping up There’s also a SharePoint Explorer for That said, I didn’t find any serious with Visual Studio and competing looking into your SharePoint site from problems, though I did get Visual Studio to in the add-ins market. Vogel also Visual Studio. lock up occasionally while debugging an speaks with DevExpress about AJAX/WCF DataServices application supporting parallel processing. And Cloud, Silverlight, Windows 7 when running in a virtual machine (VM) Jason Short, owner and architect of and WPF Support with “just enough” memory. You need at VistaDB, talks about what it’s like While Visual Studio 2010 supports both least 1GB of memory to run Visual Studio to run a software tools company. Windows Azure and Silverlight 4 develop- 2010, and 1.5GB in a VM to compensate • Also look for commentary on ment, the tooling is not installed with Visual for the lack of hardware acceleration. previous reviews and updates on Studio. For Windows Azure, you’ll need to The upgrade from Visual Studio .NET to important products and tooling open the single cloud project type, which Visual Studio 2005 was a major step for .NET developers. will start the download of the full Windows forward for .NET developers, while the

VisualStudioMagazine.com · June 2010 · VISUAL STUDIO MAGAZINE 9

VSInsider BY JAY SCHMELZER

Raising the Bar

When the Visual Studio Team started developing the 2009 was the culmination of these efforts. Share- latest version of the product, we knew that improving Point 2010 was unveiled, and along with it the support for Office and SharePoint was paramount. At first-class support in Visual Studio 2010 for building the time, SharePoint had already established itself as SharePoint solutions. Hands down, the biggest one of the most successful server products in the applause of the entire week came during the opening history of Microsoft, and developers couldn’t wait to keynote demo, when the presenter deployed a

VSInsider take advantage of its popularity. Visual Studio, custom-built Web Part from within Visual Studio however, had minimal support for building and and hit a break point by simply pressing F5. deploying SharePoint-based solutions. Developers using Visual Studio 2008 to build On the Office side of the fence, Visual Studio SharePoint solutions knew we’d taken what were 2008 delivered significant improvements for previously 27 individual steps and reduced them developers building solutions based on the Office down to the simple action of hitting F5. clients, but deploying those custom solutions remained difficult. The need to update support for Offi ce Enabler these products was clear. Visual Studio also received significant improve- ments to support Office 2010 by delivering an The SharePoint Imperative improved deployment experience for solutions built From a SharePoint perspective, we were immediately on top of Office client applications, such as Excel, faced with a difficult design challenge: How do we Word and Outlook. Office 2010 includes the Visual design the Visual Studio experience to expose all Studio Tools for Office runtime components the flexibility of the SharePoint platform, while at necessary to run Office add-ins built using the the same time easing the transition for developers Microsoft .NET Framework. new to SharePoint? As part of the .NET Framework 4 and Visual I distinctly remember an early customer design Studio 2010, we also introduced the No Primary review, when we were demonstrating a first look of Interop Assemblies (PIAs) feature, which further the Visual Studio experience. Most of the customers simplifies deployment by eliminating the need to hated it: They felt we’d abstracted the platform and deploy the PIAs as part of your Office application. taken away the development power they needed. We By eliminating the need for PIAs, developers can hadn’t found the right balance. dramatically reduce the size and complexity The team, including members of both the Visual of their deployment packages, saving them Studio and SharePoint product teams, got together time and resources. and revisited our approach. We spent a lot of time This is a very exciting year for Visual Studio talking to individual customers to understand their developers—especially for those who are building concerns and working with them on the designs to solutions that target Office and SharePoint. And it address their feedback. These reviews continued with was all made possible by the passion and dedication customers until we were sure we had it right. of those early customers and the teams across Visual The Microsoft SharePoint Conference in October Studio, Office and SharePoint that worked together to deliver a great toolset. For more information on developing for SharePoint and Office, make sure to visit msdn.microsoft.com. VSM Developers using Visual Studio Jay Schmelzer is a group program manager on the Visual 2008 to build SharePoint solutions knew we’d Studio Team at Microsoft. He and his team are responsible for taken what were previously 27 individual the Visual Studio design-time tools and runtime components steps and reduced them down to the simple used to build applications that leverage Microsoft Office client and server products. He has authored several articles and action of hitting F5. books on application development and is a frequent speaker at application development conferences.

10 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Your best source for software development tools! ®

X VMware vSphere LEADTOOLS Recognition SDK Multi-Edit NEW by LEAD Technologies by Multi Edit Software RELEASE! Put time back into your day. Develop robust 32/64 bit document Multi-EditX is “The Solution” Your business depends on how you spend imaging and recognition functionality into your time. You need to manage IT costs for your editing needs with without losing time or performance. With your applications with accurate and support for over 50 languages. high-speed multi-threaded Forms, OCR, proven cost-effective virtualization solutions OMR, and 1D/2D barcode engines. Edit plain text, ANY , hex, from VMware, you can: • Supports text, OMR, image, and XML, HTML, PHP, Java, Javascript, • Increase the productivity of your existing VMware barcode fields Perl and more! No more file size staff three times over Advanced NEW • Auto-registration and clean-up to limitations, unlimited line length, • Control downtime—whether planned improve recognition results Acceleration Kit RELEASE! any file, any size Multi-EditX is or not • Provided as both high and low 1-49 Users for 6 processors level interface “The Solution”! Paradise # • Save more than 50% on the cost of Paradise # • Includes comprehensive confidence A30Z10101A01 managing, powering and cooling servers V55 78101A01 Paradise # reports to assess performance Pre-Order Your Copy and Save! L05 26301A01 $ 20 Make your time (and money) count for $ 99 223. more with virtualization from VMware. 9,234. $ 99 3,214. programmers.com/LEAD programmers.com/multiedit programmers.com/vSphere Pragma Fortress SSH—SSH AdminStudio & Application Server & Client for Windows Virtualization Pack BUILD ON by Pragma Systems by Flexera Software VMWARE ESXi Contains SSH, SFTP, SCP servers and clients One Application Software Deployment Tool AND VSPHERE for Windows. for Reliable MSI Packaging, Application Virtualization, and Windows 7 Migration. for Centralized Management, • Certified for Windows Server 2008R2 Top choice of Microsoft®, Novell®, LANDesk® Continuous Application • Compatible with Windows 7 and other software management solutions. Availability, and Maximum • High-performance servers with Cut MSI packaging time by up to 70%, Certified centralized management Operational Efficiency in Your Deploy software to desktops with 99% Professional Virtualized Datacenter. for Windows • Active Directory & GSSAPI authentication success or better. AdminStudio is the only 7/2008R2 Upgrade from • Supports over 1000 sessions MSI packaging solution to support multiple any Active AS Programmer’s Paradise invites you to take advantage • Offers FIPS mode virtualization formats, including Microsoft® Pro + Silver Mtn of this webinar series sponsored by our TechXtend ™ ® ™ solutions division. Paradise # • Hyper-V and PowerShell support App-V , VMware ThinApp and Paradise # Citrix® XenApp™. P35 04201A01 • Runs in Windows 2008R2/2008/2003/7/ I21 09401S05 Vista/XP/2000 FREE VIRTUALIZATION WEBINAR SERIES: $ 99 $ 99 REGISTER TODAY! TechXtend.com/Webinars 550. programmers.com/pragma programmers.com/flexera 4,228. ActiveReports 6 CA ERwin® Data Modeler TX Text Control 15.1 by GrapeCity r7.3 – Product Plus 1 Year Word Processing Components NEW RELEASE! Integrate Business Intelligence/Reporting/Data Enterprise Maintenance TX Text Control is royalty-free, Analysis into your .NET applications using the by CA robust and powerful word processing software in reusable component form. NEW ActiveReports 6. CA ERwin Data Modeler is a data modeling • Fast and Flexible reporting engine solution that enables you to create and • .NET WinForms control for VB.NET and C# • Data Visualization and Layout Controls such maintain databases, data warehouses • ActiveX for VB6, Delphi, VBScript/HTML, ASP as Chart, Barcode and Table Cross Section and enterprise data resource models. • File formats DOCX, DOC, RTF, HTML, XML, TXT These models help you visualize data NEW Controls structures so that you can effectively • PDF and PDF/A export, PDF text import Professional Edition VERSION Paradise # 6! • Wide range of Export and Preview formats organize, manage and moderate data • Tables, headers & footers, text frames, including Viewer, Web T79 02101A02 complexities, database technologies Paradise # bullets, structured numbered lists, multiple Viewer, Adobe Flash and PDF and the deployment environment. undo/redo, sections, merge fields, columns Professional Ed. P26 04201E01 $ 99 Paradise # • Royalty-Free Licensing for Web and • Ready-to-use toolbars and dialog boxes 848. $ 99 D03 04301A01 Windows applications 3,919. Download a demo today. $ 99 1,310. programmers.com/grapecity programmers.com/ca programmers.com/theimagingsource BUY OR UPGRADE TO MICROSOFT® VISUAL STUDIO® 2010 TODAY 2010 IT’S TOUGH TO MATCH OUR PRICES, SERVICE AND VS 2010-READY SELECTION SPECIAL OFFER FROM INTEL SOFTWARE VS Pro 2010 New SPECIAL PROMOTION: SAVE 20% ® SAVE UP TO 30% and Get Intel® Parallel + Intel Parallel Studio on ComponentOne Studio® Enterprise Studio Enterprise Studio when you Buy or Upgrade to Paradise # P27 000D Paradise # $ 00 The world’s most complete C18 01101A07 Microsoft Visual Studio Pro 2010 VS2010-ready component 1,198. $ 00 C++ Developers: Build, test and tune SUPER FAST multi-core apps suite for developing all layers 1,040. with Intel® Parallel Studio & Microsoft Visual Studio. VS Pro 2010 Upgrade of Windows, Web, and Mobile SAVE + Intel® Parallel Studio applications. Studio Enterprise $400 programmers.com/intel_VS2010 Paradise # P27 000E w/Platinum Support Paradise # DISCOVER MICROSOFT VISUAL STUDIO 2010... $948.00 2010 READY C18 01101E02 TAKE YOUR DEVELOPMENT TEAM TO THE NEXT LEVEL! $ 00 Call your Programmer’s Paradise Representative Today! programmers.com/componentone 1,280. 866-719-1528 programmersparadise.com Prices subject to change. Not responsible for typographical errors.

Untitled-2 1 5/5/10 11:53 AM VSM COVER STORY

Why Offi ce 2010 and SharePoint 2010 are poised to unleash a new wave of developer innovation. By Michael Desmond

It didn’t take long for the combination of Visual Studio 2010 and SharePoint Server 2010 to capture the attention of ISV E·Sponder LLC. The Missouri-based provider of disaster response and emergency planning solutions is hosting its soft- ware on SharePoint 2007, and before that the company used SharePoint 2003. With the May 12 release of Office 2010 and SharePoint 2010, E·Sponder President and CEO Robert Wolf says some long-awaited pieces have finally fallen into place. The company is preparing to release its new “In the case of Crime Fighter, we’ve had a Crime Fighter product, a platform for crime desire to build something like this for about scene data entry and visual data analysis, five years now,” Wolf says. “The confluence of leveraging SharePoint 2010 and Office 2010 huge advances in Web-based geographic Business Connectivity Services (BCS). Wolf information systems, SharePoint BCS and the credits the combination of Visual Studio 2010 ever-growing capabilities of InfoPath Forms and SharePoint 2010 for making the new Services have finally come together to make it product—currently in beta testing with the practical for us to offer this as a more or less Tampa Police Department—possible. turnkey solution.”

12 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com ILLUSTRATION BY RYAN ETTER iultdoaaiecm·Jn 00· June 2010 · VisualStudioMagazine.com IULSUI AAIE13 VISUAL STUDIO MAGAZINE COVER STORY Office 2010 and SharePoint 2010

“The bottom line is that the Offi ce 2010 and SharePoint 2010 platform story we talk about to non-developers is now fully represented in Visual Studio where developers create platform solutions.” John R. Durant, Senior Product Manager, Offi ce Group, Microsoft

Wolf says previous iterations of Office and SharePoint forced “We’re retooling toward MSF Agile 5.0 now,” Wolf says. “The E·Sponder to craft complex workaround frameworks or make Visual Studio portions were constructed using a combination of “significant architectural capability compromises.” He explains: “As our homegrown tooling and the new 2010 Managed Extensions an ISV we need to build applications [that] can readily connect to for SharePoint.” whatever LOB [line-of-business] environment the customer may Another major improvement in Visual Studio 2010 is the integration have, without extensive custom development. This one really just of the Managed Extensibility Framework (MEF), a platform for snapped together in 2010.” enabling composable applications by allowing applications to discover available components and resources. Using the MEF, Tooling Focus developers can craft components that integrate with Visual Studio A lot of development organizations are reaching the same conclusion. and enable rich, purpose-built functionality. Coming about a month after the release of Visual Studio 2010, both Gains like these have made a huge difference, Wolf explains. Office 2010 and SharePoint 2010 significantly advance application “The difference, frankly, is night and day. It’s obvious the Visual development targeting the two platforms. Office brings improve- Studio and SharePoint teams are collaborating heavily and recog- ments in the areas of application deployment and access to disparate nized the huge gap in the prior tooling,” he says. “There are still data sources over BCS, while SharePoint boasts major improve- gaps, but the existing tools—coupled with the adoption of the ments in data handling and rich integration with the Visual Studio MEF—ensure the gaps are readily fillable in an integrated and development stack. composable manner.” “Perhaps the most important advance in Visual Studio 2010 in terms of business productivity solutions is the addition of SharePoint The SharePoint Surge development tools,” says John R. Durant, senior product manager The surge in interest in SharePoint development is as much about in the Microsoft Office Group. “The bottom line is that the Office the robust new tooling in Visual Studio 2010 as it is about the 2010 and SharePoint 2010 platform story we talk about to non- expanded, application-savvy feature set of SharePoint itself. Both developers is now fully represented in Visual Studio, where SharePoint and Office 2010 add BCS for linking SharePoint and developers create platform solutions.” Office apps with diverse back-end systems like SQL Server, Bola Rotibi, principal analyst for U.K.-based analyst firm MWD Microsoft Dynamics CRM and SAP, among others. SharePoint Advisors, praises the work Microsoft has done in bringing develop- also boasts a version of LINQ (SP LINQ) for efficiently querying ment up to grade with SharePoint 2010. But she says Microsoft had SharePoint data. little choice but to fix what she calls the “nasty development experi- Lee Garf, vice president of product management for the SharePoint ence” under SharePoint 2007 and Visual Studio 2008. Solutions Group at Parametric Technology Corp. (PTC), says his “They really had to push SharePoint; they really had to bring that company relied heavily on the BCS capabilities of SharePoint to in line,” says Rotibi. enable functionality in its Windchill engineering and product Arpan Shah, director of SharePoint Products and Technologies at development process solution. Microsoft, says Microsoft did exactly that with SharePoint 2010. “In “PTC was especially interested in the new social-computing 2010, the developer was a core segment that we looked at,” Shah says. features in SharePoint 2010 and the advanced capabilities of BCS,” “We were really building on the giants of .NET and SQL as we started Garf says. “Without the new capabilities in SharePoint 2010, we to build SharePoint as a platform. With the 2010 release it becomes a would’ve had to build these capabilities ourselves.” first-class developer platform for a number of reasons.” There were early challenges. “Initially we were confounded with Those reasons include extensive work in Visual Studio 2010 to the new user model and how it maps Visual Studio concepts to bring SharePoint to parity with established development approaches SharePoint,” says Garf, citing thin documentation during the beta like ASP.NET and Windows Presentation Foundation (WPF). For cycle. “But once we understood it, it’s been fantastic.” instance, SharePoint project templates are now accessed from the The new SharePoint Client Object Model (OM) allows developers same explorer interface as ASP.NET and Windows Forms projects, to write Silverlight, JavaScript or Microsoft .NET Framework- and SharePoint developers enjoy access to all the QA/test functionality based client applications that access SharePoint data and integrate in the Visual Studio stack. SharePoint projects also gain access to a with the SharePoint environment. SharePoint can now easily host a true F5 experience, with one-click build/debug/deploy. The ability WinForms- or WPF-based .NET application or a JavaScript app to develop SharePoint applications on a Visual Studio-equipped running inside a SharePoint Web Part. client, rather than a SharePoint Server-based system, also removed Spanish Point Technologies Ltd., maker of LookupPoint soft- a major obstacle to development. ware, has been updating its solution for SharePoint and Office Wolf, of E·Sponder, says his team is writing Crime Fighter in C# 2010. LookupPoint enables streamlined workflow and informa- under the Microsoft Solutions Framework (MSF) Agile 4.0 devel- tion access by enabling Office users to immediately access and opment process. The project is managed using Team Foundation preview detailed information related to what’s presented in Office Server (TFS) 2010. documents. For instance, a worker can hover a mouse over an

14 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Microsoft TechEd booth #2044.

®

ESRI Developer Network Visit us at Integrate Mapping and GIS into Your Applications

Give your users an effective way to visualize and analyze their data so they can make more informed decisions and solve business problems.

By subscribing to the ESRI® Developer Network (EDNSM), you have access to the complete ESRI geographic information system (GIS) software suite for developing and testing applications on every platform. Whether you’re a desktop, mobile, server, or Web developer, EDN provides the tools you need to quickly and cost-effectively integrate mapping and GIS into your applications.

Subscribe to EDN and leverage the power of GIS to get more from your data. Visit www.esri.com/edn.

Copyright © 2010 ESRI. All rights reserved. ESRI, the ESRI globe logo, EDN, and www.esri.com are trademarks, registered trademarks, or service marks of ESRI in the United States, the European Community, or certain other jurisdictions. Other companies and products mentioned herein may be trademarks or registered trademarks of their respective trademark owners.

Untitled-1 1 5/3/10 12:58 PM COVER STORY Office 2010 and SharePoint 2010

“Initially we were confounded with the new user model and how it maps Visual Studio concepts to SharePoint. But once we understood it, it’s been fantastic.” Lee Garf, VP of Product Management, SharePoint Solutions Group, Parametric Technology Corp.

invoice number in an Outlook e-mail, see a quick preview of data and in-place records management. There was no existing global related to the invoice, and click through to a detailed full report. retention policy,” Lele explains. “SharePoint 2010 implements many Spanish Point leveraged the SharePoint Client OM to support of the features, which reduced the amount of customizations SharePoint as a data source within its solution, so customers could required and time to implement a more complete [records man- expose SharePoint information alongside data from LOB systems. agement] solution than what currently exists in MOSS 2007.” “The new SharePoint Client OM provides a great way for us to Lele says his team leveraged the in-place records management, integrate with SharePoint. This is a much richer way of integrating enterprise content types and managed metadata services features of with SharePoint than the Web services that were available in SharePoint 2010. He says there was some complexity in working with SharePoint 2007,” says John Corley, CTO for Spanish Point. “It new resources like Managed Metadata Term Stores and Term Sets. takes less code and you don’t have to spend lots of time building up “This was entirely new OM code to learn and understand,” Lele classes in your client code just to call the Web service.” says, adding: “Microsoft provided significant support in this area by For Vishwas Lele, CTO for consultancy Applied Information providing code samples and reviewing code to support the project.” Services, SharePoint 2010 is being used to update an in-place records Shah, of Microsoft, says developers should leverage the SharePoint management system based on Microsoft Office SharePoint Server developer framework to build rich apps so they can better focus on (MOSS) 2007. the business logic. “By using the out-of-the-box pieces, developers “The project was already implemented in MOSS 2007, but with won’t have to worry about the plumbing longer term,” Shah says, significant customizations to implement a global metadata taxonomy offering SharePoint’s ability to run sandboxed apps as an example.

The Path to 2010

Office and SharePoint 2010, combined with Visual Studio 2010 tests for corner cases we don’t have any reason to suspect exist,” and the Microsoft .NET Framework 4, have significantly improved Wolf says. “This degree of detail is part of the extra burden you pick development opportunities across the board. But dev shops face up when SharePoint becomes a platform instead of just a product.” challenges in mastering the new tooling and resources. Arpan Shah, director of SharePoint Product and Technologies at Applied Information Services’ Vishwas Lele says the familiar Microsoft, says the company is rolling out extensive documentation Visual Studio tooling helped ease the transition to SharePoint and support resources for developers, including detailed develop- 2010 development. But Infragistics’ Jason Beres says developers ment best practices. must have the right skills in place to really take advantage of it. John Corely, CTO of Spanish Point Technologies Ltd., cautions “The key thing is, if you’re not used to using REST or Web services, developers away from writing custom code for SharePoint 2010. make sure to learn that first,” Beres says. “The amazing thing is if “Check out the new SharePoint project and item templates in detail you’re using Visual Studio 2010 and you’re coming from SharePoint before you code your own SharePoint 2010 solutions,” he says. 2007 in general, you’re going to be amazed how much easier it is “Chances are something that you coded manually in SharePoint to work with SharePoint in 2010. Just in the project templates, so 2007 can be done much more quickly using a new template.” much stuff is done for you.” Still, Corley would welcome support for richer research services Robert Wolf, president and CEO of E·Sponder LLC, tells developers content in the Office client. “It would be great to have HTML or to take their time as they come to grips with the new project and Silverlight in there. This would enable even more server-based application lifecycle management tooling. functionality to be embedded within Office clients.” “The cutover from Visual SourceSafe to TFS [Team Foundation Lee Garf, VP of product management for the SharePoint Solutions Server], and from project server-based tracking and homemade Group at Parametric Technology Corp., urges dev shops to move to process management to TFS at the same time, was wrenching,” he Visual Studio 2010 now. He hopes Microsoft will broaden developer says. “But it’s paying off already.” access to internal classes over time. “Visual Studio 2010 and He says he’d also like to see Microsoft fill out its documentation SharePoint 2010 provide a dramatically better platform for developers, and support for SharePoint development. He singles out the new but there are still too many areas where code is obfuscated,” he says. SharePoint Object Model and Web API documentation, noting corner Ultimately, the combination of Visual Studio 2010, Office 2010 cases and exceptions that can occur with specialized collections, and SharePoint 2010 will let developers do more with less effort. such as whether they will return null or throw an exception. Today, “Anyone who’s tried SharePoint development in Visual Studio dev shops must write their own tests for many of these scenarios. 2008/SharePoint 2007 and decided, ‘this is just too hard for us,’ Wolf would additionally like to see more deep, developer- definitely needs to try the new tools,” Wolf says. “Getting started in oriented documentation for the Office suite—including the InfoPath SharePoint development is still a big bite to swallow, but it’s much Designer. “We can’t reverse-engineer in quality and we can’t write less than half the bite it used to be.” —M.D.

16 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Uncover Web development simplicity with thee complete set of toolsols from Altova®

Experience how the Altova MissionKit® suite of integrated XML and database tools can simplify even the most advanced Web 2.0 development projects.

The Altova MissionKit includes powerful Web development tools:

StyleVision® – graphical stylesheet & electronic forms designer • Drag-and-drop XSLT 1.0/2.0 and XSL-FO stylesheet design • Advanced CSS and JavaScript functionality • Precise electronic forms design XMLSpyXMLS ® – advanced XML editor • XSLTXS 1.0/2.0 editing, debugging, and profiling ersi • XXSLT editing help, support for program code in V NewNew in Version 2010: in stylesheets 64-bit version • DDiffDog® – XML-aware diff / merge utility • New design paradigm for creating stylesheets and electronic forms • File, folder, directory, DB comparison and merging • True electronic forms design through absolute positioning • One-click directory syncing JSON editing® &Server conversion support • And more… • SharePoint • And much more

Download a 30 day free trial!

Try before you buy with a free, fully functional trial from www.altova.com.

Untitled-1 1 4/28/10 11:25 AM COVER STORY Office 2010 and SharePoint 2010

“We were really building on the giants of .NET and SQL as we started to build SharePoint as a platform. With the 2010 release it becomes a fi rst-class developer platform for a number of reasons.” Arpan Shah, Director of SharePoint Products and Technologies, Microsoft

SharePoint 2010 sandboxing enables apps to run in a limited-trust new Open XML SDK 2.0. Developers can craft server- or client-side environment—useful both for legacy code and hosting third-party applications that interact with Open XML Office document and solutions. Sandboxed code can also be readily deployed to the data files, enabling a host of document processing scenarios. Microsoft SharePoint Online service in the cloud, giving SharePoint “With the SDK, developers now have direct, element-level access applications a level of portability. The Microsoft SharePoint 2010 to document content. It’s great for enabling solutions to extract, Online service is scheduled to go live in the second half of 2010. examine or modify a document’s contents,” Durant says. There’s a lot to like for developers in the latest version of SharePoint. Still, says Durant, there are times when developers will want to Jason Beres, vice president of product management for component- turn directly to the Office APIs. While the SDK makes it easy to maker Infragistics, has been following developments in the push data into an Excel spreadsheet file, for instance, he says devel- Office and SharePoint development space with interest. He says opers will want to turn to the Excel APIs to kick off complex Microsoft has made tremendous progress in reducing the amount calculations. “This is when using code against the Office APIs of work developers do for common tasks, particularly around comes back into play, and we continue to encourage and support data and deployment. programming Office applications in that way,” Durant says. “The core things we focus on here are deployment and the ability “Additionally, we’ve added the programmable Backstage view to work with data: edit data, delete data, update data. That’s an across the broad set of applications, and that’s a new opportunity enormous amount of code in 2007 that just goes away,” explains for developers to tailor the user interface much like the Ribbon,” Beres, who says data access projects that took a month in SharePoint Durant continues. “At the same time, we’ve added new API 2007 can now be achieved in two days. members in each of the applications to accommodate new user “You’re dealing with services; you’re not so concerned with the features such as Excel Sparklines and slicers, or new media control SharePoint code as you are just working in your normal .NET features in PowerPoint. We’ve made analogous changes in Word, code—manipulating data, displaying data and pushing it back Outlook, OneNote, Project, etc.” through a Web service,” he explains. Sparklines are cell-based data charting and visualizations, while slicers are useful filter controls that float above the spreadsheet The Offi ce Outlook interface. The Office 2010 Backstage view is a new interface While SharePoint 2010 has enjoyed an extensive developer makeover, element that enables Office 2010 to better expose complex or little- Office 2010 emerges with more limited—but still real—benefits used functionality that doesn’t surface intuitively in the document for the development community. Unsurprisingly, Beres says dev or the Ribbon UI. In a blog post, Microsoft Senior Program shops will be slower to target application development for Office Manager Clay Satterfield offers examples like permissions, ver- 2010 than SharePoint 2010, despite new social networking tie-ins sioning, workflows and other activities that are assigned to the and data-centric features like PowerPivot. Backstage View (tinyurl.com/l9hy5). “I think there are a lot of cool stories, but I think it will be some The updated LookupPoint software from Spanish Point taps into time before it can soak in. Everyone probably has always been fairly enhancements of the Office 2010 Research pane interface to happy with Office and what it delivers for them, so they don’t expect improve performance and user experience. anything more,” Beres says, adding that Microsoft did a lot to boost “It was possible to significantly improve the speed of doing a lookup, application development with Visual Studio 2008 and Office 2007. in terms of user clicks required, and it was also possible to provide One area of Office that did need cleaning up was the use of the preview of entities when the user hovered [the mouse] over it. primary interop assemblies (PIAs) for managed code applications We could achieve this without needing a client-side component for calling Office COM resources. PIAs act as a bridge that allows our solution,” says Spanish Point’s Corley. developers to execute managed .NET code against native COM Ultimately, the refinements to Office, particularly in the area of APIs. The problem is that Office application developers must application deployment and cloud-savvy services, make Office 2010 deploy PIAs, which are themselves essentially large collections of a relevant app dev target. MWD analyst Rotibi credits the steady APIs, along with their client applications. maturation of the underlying .NET Framework for improving Jay Schmelzer, program manager on the Visual Studio Team at the appeal of Office as a target for development. Microsoft, singles out PIAs as an important improvement to the tool “It’s taken a long time, but I think everything went well as a plat- stack for Office development in this month’s VSInsider column form when Microsoft started leveraging Windows Presentation (“Raising the Bar,” p. 10). “By eliminating the need for PIAs, developers Foundation, Windows Workflow Foundation and the rest,” says can dramatically reduce the size and complexity of their deployment Rotibi. “There has been a unification of the underlying platform, packages—saving them time and resources,” he explains. For more on and that has allowed them to bring things forward in a much PIAs in this issue, see the Type Equivalence Support section in this stronger and unified way.” VSM month’s On VB column, “What’s New in Visual Basic 2010” (p. 32). Microsoft Senior Product Manager Durant also singles out the Michael Desmond ([email protected]) is editor in chief of Visual native Office file formats, and the programmability aspects of the Studio Magazine.

18 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com WPF Grid Fast Data Chart

Silverlight Grid

ASP.NET Grid

At Infragistics, we make sure our NetAdvantage for .NET controls make every part of your User Interface the very best it can be. That’s why we’ve tested and re-tested to make sure our Data Grids are the very fastest grids on the market and our Data Charts outperform any you’ve ever experienced. Use our controls and not only will you get the fastest load times, but your apps will always look good too. Fast and good-looking…that’s a killer app. Try them for yourself at infragistics.com/wow.

Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91-80-6785-1111 twitter.com/infragistics Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics and the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc.

Untitled-12 1 4/9/10 1:54 PM Untitled-3 2 4/7/10 3:42 PM Untitled-3 3 4/7/10 3:42 PM FEATURE

New APIs and native support for resources like the Ribbon UI, the Windows 7 Taskbar and parallelism boost native development. BY MARIAN LUPARU

22 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com FEATURE

You don’t need to work in .NET to take advantage of some of the documentation available on the philosophy behind the some of the most noteworthy features of Windows 7. You Microsoft Office Fluent UI, the guidelines of designing a new Ribbon-centric UI and the licensing requirements that come with can take full advantage of capabilities like Jump Lists and using the Ribbon (see “Windows Ribbon Resources,” p. 28). file preview/search in your Microsoft Foundation Classes To get a better idea of how your Ribbon UI will look, the new (MFC) application, whether you’re upgrading it to Visual Ribbon Designer in Visual Studio 2010 helps create the Ribbon and wire it to new and existing event handlers in your code. This is Studio 2010 or starting a brand-new project. Visual C++ shown in Figure 2 (p. 26). Because the MFC Ribbon control is 2010 ships with many enhancements to MFC and the Active using the same WM_COMMAND-based event handlers, you can Template Library (ATL) that target Windows 7 out of the reuse the command IDs exposed previously by the menu and tool- box. The Visual C++ IDE also has important enhancements bars and streamline the migration. The Ribbon Designer stores the serialized representation of to make the day-to-day development of modern Windows the Ribbon as a resource in XML format. At runtime, use the applications more productive. CMFCRibbonBar control to load the XML and recreate the Ribbon To get started, all you need to do is take your MFC application controls, as shown here: and recompile it in Visual C++ 2010 or fire up the new Project Wizard and create a new MFC application. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... MFC 10 Applications “Light Up” to Windows 7 m_wndRibbonBar.Create(this); After you compile your code with the latest version of MFC, the // m_wndRibbonBar is a protected member application is already prepared to showcase some of the new // of type CMFCRibbonBar Windows 7 functionality—that is, without any new lines of code m_wndRibbonBar.LoadFromResource(IDR_RIBBON); yet. Let’s look closer at some of the new features. // IDR_RIBBON is the resource created First thing, your application becomes DPI-aware. This means it // by the Ribbon Designer will integrate with the Windows 7 High-DPI settings that enable ... users to keep their displays at the native resolution of the hardware } while still making fonts and the UI appear bigger on the screen. In contrast, the UI of an application that’s not High-DPI-aware will be Office Ribbon support first shipped as part of the Visual C++ stretched to appear larger, which can create a pixelated effect on the 2008 Feature Pack and later as part of the Visual Studio 2008 SP1. If images or blur the text, reducing its readability. you already spent time redesigning your UI to incorporate the MFC controls are High-DPI-aware and, as a result of declaring Ribbon and your application is using the MFC Ribbon with the the application High-DPI-aware, they’ll render correctly under Office look and feel, in Visual Studio 2010 all you need to do is these conditions. If your application does any custom drawing, you change the look and feel of your Ribbon to Windows 7 by adding may still want to validate its look and feel under each available DPI two lines of code to your mainframe initialization code: setting. You can temporarily disable High-DPI support in your application by going to the project’s Property Pages | Manifest Tool | int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) Input and Outputs | Enable DPI Awareness and setting it to No. { ... Figure 1 (p. 24) shows a tab-based MFC application for which the CMFCVisualManager::SetDefaultManager( Windows 7 Taskbar automatically shows not only a thumbnail of RUNTIME_CLASS(CMFCVisualManagerWindows7)); the windows but also a thumbnail of each currently open document. m_wndRibbonBar.SetWindows7Look(TRUE); MFC applications tell the Windows 7 Taskbar how many docu- ... ments are open and provide a live thumbnail preview of their } content without any new code required on your side. If your application has one or more file extensions associated with it If you’re upgrading your Ribbon from Visual Studio 2008, your and the implementation is using common dialog boxes to open files, existing application doesn’t use the new declarative way of defining the Windows Taskbar Jump List (displayed when right-clicking on the the Ribbon (the XML representation supported by Ribbon Designer). application Taskbar button) will also automatically get populated with To use the Ribbon Designer in your development, you need to the most recent documents the user opened using the application. I’ll replace your Ribbon creation code with the declarative XML- talk more about how you can customize this list later on in this article. based creation. MFC helps you make this substitution by allowing For now, let’s focus our attention on your application mainframe. you to save an already-created Ribbon (regardless of the approach used) to XML. Just add the following line below your Ribbon Modernize Your Application Using the Windows Ribbon creation code and run your application: An important decision you need to make as you migrate your app to Windows 7 is whether you want it to use the new Windows 7 m_wndRibbonBar.SaveToXMLFile( Ribbon. Windows 7 features the Ribbon interface throughout the L"my2008ribbon.mfcribbon-ms"); OS, enabling improved UI development on the platform. Whether your application is already using the MFC Ribbon control or not, This call will generate an XML serialization of the runtime repre- Visual C++ 2010 helps with migrating to the new Windows 7 Ribbon. sentation of the Ribbon at the time of the call. You can then add the If your application is using menus and toolbars, migrating to the file to your MFC application as a Ribbon resource and replace all the Ribbon requires some planning. For that, I recommend reading creation code with one call to CMFCRibbonBar::LoadFromResource.

VisualStudioMagazine.com · June 2010 · VISUAL STUDIO MAGAZINE 23 FEATURE Windows 7 Native Development

BOOL CMainFrame::OnGestureZoom(CPoint ptCenter, long lDelta) { if ((m_pCurrentGestureInfo->dwFlags & GF_BEGIN) == GF_BEGIN) { m_dblZoomRatioStart = lDelta; m_drawingObject = GetObjectUnderPoint(ptCenter); } else if (lDelta != 0) { double zoomFactor = (double)(m_dblZoomRatioStart + lDelta)/ m_dblZoomRatioStart; m_drawingObject.Zoom(zoomFactor, ptCenter.x, ptCenter.y); m_dblZoomRatioStart += lDelta; RedrawWindow(); }

return TRUE; }

Some gestures have legacy behavior when not handled by the devel- Figure 1. MFC applications automatically provide Taskbar previews oper. For more information, see “Legacy Behavior of Gestures,” p. 26. for each document and tab opened. By default, rotate gesture detection isn’t enabled. If your application wants to detect and handle this gesture, or control what gesture Enable Multi-Touch events to receive in general, call CWnd::SetGestureConfig for each Touch and multi-touch features provide an intuitive way for users to affected window, as in this example: interact with PCs, and enable multiple input events to occur at the same time from different touch points. Based on these, complex int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) gesture events are recognized by the OS or your app. Consider the { ... implications of responding to multiple input events and how to cus- CGestureConfig cfg; tomize app behavior if multi-touch-capable hardware is available. GetGestureConfig(&cfg); // get gesture defaults Verify there’s a multi-touch-enabled device on the system by checking cfg.EnableRotate(); // enable rotate gesture system metrics SM_DIGITIZER and SM_MAXIMUMTOUCHES: SetGestureConfig(&cfg); // set configuration ... BYTE digitizerStatus = (BYTE) GetSystemMetrics( } SM_DIGITIZER); if ((digitizerStatus & You can handle the WM_TOUCH message directly by overriding (NID_READY + NID_MULTI_INPUT)) == 0) the virtual method CWnd::OnTouchInput if you want to create more //Stack Ready + MultiTouch complex interactions inside your application. The OnTouchInput { event handler receives individual touch events as they occur. Your MessageBox(L"No touch input is currently available."); application can either handle each touch event separately or com- } bine them to recognize custom gestures. else You need to call Register TouchWindow() as part of the initial- { ization code in order to enable a window to receive this event. BYTE nInputs = OnTouchInput will get called for each touch point that occurs inside (BYTE) GetSystemMetrics(SM_MAXIMUMTOUCHES); the client area of the window:

CString str; BOOL CMainFrame::OnTouchInput(CPoint pt, str.Format( int nInputNumber, int nInputsCount, L"Touch input available with %d touch points.", PTOUCHINPUT pInput) nInputs); { MessageBox(str); if( (pInput->dwFlags & TOUCHEVENTF_DOWN) == } TOUCHEVENTF_DOWN ) { Windows 7 consumes the low-level touch messages to recognize the CString str; gesture and sends it to a consuming window. There are six gestures str.Format(L"Touch input event %d of %d", that your application can respond to: zoom, pan, rotate, press, tap and nInputNumber, nInputsCount); two-finger tap. You can handle any gesture event in your MFC applica- GetDC()->TextOutW(pt.x, pt.y, str); tion by overriding the corresponding virtual method of any class } derived from CWnd (like CMainFrame in the following example): }

24 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Fast Data Charts

Geospatial Maps

Silverlight Pivot Grids

You’ve got the data, but time, budget and staff constraints can make it hard to present that valuable information in a way that will impress. With Infragistics’ NetAdvantage for Silverlight Data Visualization, you can create Web-based data visualizations and dashboard-driven applications on (and coming soon for WPF) that will not only impress decision makers, it actually empowers them. Go to infragistics.com/sldv today and get inspired to create killer apps.

Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91-80-6785-1111 twitter.com/infragistics Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics and the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc.

Untitled-12 1 4/9/10 1:55 PM FEATURE Windows 7 Native Development

Windows 7 also provides platform support for object manipula- tion and inertia processing to fine-tune the multitouch experience. Your application can provide a natural touch interaction with the artifacts provided by its UI. The COM-based APIs enable combi- nations of gestures to occur at the same time on one or multiple objects (for example, zoom while translating at the same time) and rendering of realistic object physics as a response of those gestures (for example, tossing to a corner or shaking an object).

Taskbar Integration In the first section of the article we talked about two new capabilities of the new Windows Taskbar—document thumbnail and Jump Lists— and how you can immediately take advantage of them by simply recompiling your code with MFC 10. The new Windows Taskbar has a few more capabilities you can use to provide the user with visual cues of the state the application is in or quick context menu actions. Figure 2. The Visual Studio 2010 Ribbon Designer. Rather than displaying only the most recent documents opened— the default behav ior MFC provides for Jump Lists—you can If your application main window is in the middle of a lengthy task customize the Jump List content by using the new MFC CJumpList that doesn’t require user interaction, it can notify the user of its progress class. This class provides methods for adding new categories of items, directly by displaying a progress bar in the Taskbar. To display a prog- managing the items listed in those categories and adding specific ress bar in the Windows Taskbar, all you need to do is define the range tasks relevant to your application. For example, the following code and set the position by calling CFrameWnd::Set ProgressBarRange and makes the default category Recent visible, creates a new category CFrameWnd::SetProgressBarPosition. You can also alter the state of called Favorites, adds the currently focused document to it and then the progress bar. For example, in case you can’t determine the duration appends three tasks that will launch the browser with different URLs: of the task, you can set the progress bar state to be “indeterminate.” If the user pauses the task execution or if an error occurs, you can change CJumpList jumpList; the state to paused or error, respectively, as in the following example:

jumpList.InitializeList(); CMainFrame* mainFrm = jumpList.AddKnownCategory(KNOWNDESTCATEGORY::KDC_RECENT); dynamic_cast(AfxGetApp() jumpList.AddDestination(L"Favorites", ->GetMainWnd()); m_pDocument->GetPathName()); if(mainFrm != nullptr) { jumpList.AddTask(strPathToBrowser, mainFrm->SetProgressBarRange(0, 100); L"http://blogs.msdn.com/vcblog/", mainFrm->SetProgressBarPosition(40); L"Visual C++ Blog", strPathToBrowser, 0); jumpList.AddTask(strPathToBrowser, mainFrm->SetProgressBarState(TBPF_ERROR); L"http://msdn.com/visualc", } L"C++ Developer Center", strPathToBrowser, 0); jumpList.AddTaskSeparator(); To make your application communicate a more customized state jumpList.AddTask(strPathToBrowser, to the user, take advantage of the Windows Taskbar ability to display L"http://msdn.com/windows", overlay icons on top of an application Taskbar button. Do this with L"Windows 7 Developer Center", strPathToBrowser, 0); the method call CFrameWnd::SetTaskbarOverlayIcon:

jumpList.CommitList(); CMainFrame* mainFrm = dynamic_cast(AfxGetApp() In this example, even after the app exits, the customized Jump List ->GetMainWnd()); will still be available to users when they right-click on the pinned if(mainFrm != nullptr) Taskbar button. The Windows Taskbar takes care of storing the Jump { List information for each running or pinned app (see Figure 3, p. 28.) if(NewDocumentsPendingReview())

Legacy Behavior of Gestures Gesture CWnd Virtual Method Legacy Behavior Default

Zoom Virtual BOOL OnGestureZoom(CPoint ptCenter, Long lDelta); Yes: Ctrl + Scroll Wheel Enabled Pan Virtual BOOL OnGesturePan(CPoint ptFrom, CPoint ptTo); Yes: Scroll Enabled Rotate Virtual BOOL OnGestureRotate(CPoint ptCenter, Double dblAngle); No Off Two-Finger Tap Virtual BOOL OnGestureTwoFingerTap(CPoint ptCenter); No Enabled Press and Tap Virtual BOOL OnGesturePressAndTap(CPoint ptPress, Long lDelta); No Enabled

26 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Untitled-1 1 4/28/10 11:37 AM FEATURE Windows 7 Native Development

mainFrm->SetTaskbarOverlayIcon(IDR_FILEICON, L"New documents available"); else mainFrm->SetTaskbarOverlayIcon((HICON)nullptr, L""); // clears the overlay icon }

Preview, Thumbnail and Search If your MFC application manages its own document types, then beyond the icon you’ve selected, Windows Explorer doesn’t present much information about the file content. By contrast, Word docu- ments and images offer a thumbnail or preview of the content. These are not new Windows 7 features; they were introduced in Windows Vista. What is new is that Visual C++ 2010 comes with a set of ATL and MFC classes and wizards that allow you to create Windows Shell Extensions that can leverage the code you wrote for your MFC document and view classes to provide the following: ■ Thumbnail icon generation ■ Document preview ■ Search integration When creating a new MFC app, the MFC Project Wizard can create a separate ATL project for implementing the Shell Extensions. When you have an existing application, invoke the ATL Wizard and specify a file extension and the types of handlers you want the project to implement for that: preview, thumbnail and search. If Figure 3. The customized Jump List. you want the handlers to automatically instantiate your existing MFC document and view classes, make sure you uncheck Generate if it’s used with or other rendering technologies, the ATL-based document and provide the name and the full path of Animation APIs provide a framework for scheduling and executing the document and view classes, then implement your handler code animations, including sophisticated conflict resolution when mul- in the MFC classes. Alternatively, Generate ATL-based document tiple animations attempt to manipulate the same variable. will create a common ATL wrapper class that all handlers will in- Connected applications are becoming the norm in modern appli- stantiate. Inside this wrapper, you can control whether you want to cations. Windows 7 provides native support to both communicate delegate the implementation to your MFC code or provide an alter- with and implement SOAP Web services by using the Windows native implementation for some of the handlers. Web Services API, which supports a broad set of the WS-* family of protocols and provides an effective way for developers to access the Accessing Windows 7 APIs Directly cloud, corporate services or local Web services. Visual Studio 2010 includes the Windows 7 SDK headers and libraries Coupled with these technologies, Windows provides a new frame- in the box. The SDK gives you direct access to a wealth of new work for consuming and implementing sensors. This new technology Windows 7 APIs, in addition to those we’ve already discussed. helps provide more environmental awareness to Windows-based Windows 7 comes with support for high-fidelity graphics that applications. A new API developed on top of this platform is the you can incorporate in your applications to provide modern inter- Location API, which can give applications coordinate information on actions and feedback to the user. Direct2D provides immediate the current location of the device (provided there are GPS or wireless access to accelerated-graphics capabilities via a simplified 2-D API sensors enabled and that the user grants access to the data). that’s based on . This is an alternative to GDI and GDI+ and provides superior performance while still having a good Parallelization Enhancements interoperability with these technologies. A well-parallelized application is always more efficient than a single- DirectWrite enables high-quality ClearType text rendering and threaded application. As we move into the age of many-core CPUs, layout. DirectWrite takes advantage of hardware-accelerated text having your application scale with the number of processors becomes when used with Direct2D, but the API can also be used with other critical—and having the right tools to help with this effort is essential. rendering engines. The same is true for the new Animation API— New in Visual C++ 2010, the Concurrency Runtime (ConcRT) provides a C++ library that allows developers to harness the power of multi-core in a productive way. The idioms of ConcRT are: ■ Parallel algorithms (generic algorithms that act on collections Windows Ribbon Resources of data) ■ Tasks (a mechanism to encapsulate what work you want to accomplish rather than how you want to parallelize it) Microsoft Office Fluent UI Overview: tinyurl.com/2xz4hb ■ Agents (using message passing for fine-grained dataflow Office Fluent UI Developer Center: tinyurl.com/28528w7 and pipelining of computationally intensive tasks) Office UI Licensing Developer Center: tinyurl.com/6a9jbl Windows 7 has a new lightweight thread scheduler called User- —M.L. Mode Scheduling (UMS) that lets high-performance apps (rather

28 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com FEATURE

than the kernel) schedule, throttle and control the overhead due to blocking system calls. You may not use UMS directly to speed up your app, but by supporting this level of flexibility in managing threads at the user-mode level, you let higher-level concurrency libraries (such as ConcRT) provide an optimized multithreading behavior. ConcRT takes advantage of UMS by defining a Scheduler- Policy with SchedulerKind member set to UmsThreadDefault. The following snippet uses task parallelism (and C++ lambdas) to asynchronously download multiple files from the Web:

Concurrency::task_group tasks; // a task_group // manages the execution of multiple tasks Concurrency::concurrent_vector thumbnails; // concurrent_vector is the thread // safe equivalent of std::vector Concurrency::concurrent_vector fileList; std::shared_ptr objWebImages = make_shared(); for( int i = 0; i < imageUrlList.Image->ResultsCount; ++i ) { // task_group::run will // queue a task for execution. tasks.run( [objWebImages, i, imageUrlList, &fileList, &thumbnails, this] { // C++0x lambda expression // these lengthy operations will now execute // on a different thread CString thumbFileName = objWebImages-> DownloadThumbnailImage( imageUrlList.Image->Results[i]); CString imageFileName = objWebImages-> DownloadImage( imageUrlList.Image->Results[i]); // push_back may be called concurrently from // different threads at the same time fileList.push_back(imageFileName); thumbnails.push_back(CThumbnail::Load( imageFileName, thumbFileName)); } ); } tasks.wait(); // first blocking call. this will wait // for all queued tasks to complete

Overall, Windows 7 is an exciting release for developers. With thousands of new Windows APIs made available to native coders, Windows 7 provides an enhanced experience for desktop applications. Visual Studio 2010 is the IDE of choice to take advantage of the Windows 7 platform. With enhancements in MFC and the ATL and the addition of new IDE Designers and Wizards, Visual C++ 2010 gives you the opportunity to be on the cutting edge in terms of leveraging OS functionality. VSM

Marian Luparu is a senior program manager on the Visual C++ team. For the past five years, he worked on different areas of the IDE and C++ Libraries, including the MSBuild-based C++ Build System and Project System, the new C++ IntelliSense engine and the simplified C++ Libraries deployment model. Untitled-2 2 5/14/10 10:45 AM Untitled-2 3 5/14/10 10:46 AM

IN THIS SECTION: On VB · 32 ///////////////////////////////

{ ON VB }

What’s New in Implicit Line Continuation The most striking thing when looking at Visual Basic 2010 code is Visual Basic 2010 the lack of line-continuation characters. At last we can use long and With the release of Visual Studio 2010 and the .NET Framework 4, expressive method and variable names in statements that span it’s time for Visual Basic developers to start leveraging the new several lines without constantly holding down that annoying shift capabilities of Visual Basic 2010. key to type the underscore line-continuation character, as shown in BY JOE KUNK Listing 1 (p. 34). While code with implicit line-continuation characters is functionally equivalent to code with line-continuation Visual Basic 2010 Visual My very first learning experience with computers involved HP characters, it just removes a lot of unnecessary noise from the code BASIC on a DEC Teletype that had no screen and could only and makes the source code even more readable. C# developers print interactions on 14-inch-wide green bar paper. During my have enjoyed this benefit from the outset, and finally Visual Basic high school years in the late 1970s, I’d stay after school while a developers have it as well. friend went to football or basketball practice, spend hours on the school’s only computer terminal, and then catch a ride home Auto-Implemented Properties with him after practice. I printed out the HP Basic source code Auto-implemented properties simply describes the new one-line for simple games like Tic-Tac-Toe or Hangman and read it over statement for properties that store and retrieve data and don’t do and over again until I was able to fully understand the program- any special processing during the get or set operation. Because the ming logic. majority of properties in a typical application fall into this category, I couldn’t have been happier—I understood a secret language this can be a real time-saver. C# has had this feature since version that no one else in my class even knew existed, and I could make 3.0 was released in November 2006. Examples for Visual Basic auto this amazing computer terminal device do my bidding with just a properties, C# auto properties and the full Visual Basic property few lines of code. Some 30 years later at our high school class syntax are shown in Listing 2 (p. 34). reunion, I profusely thanked Chris Parker, the classmate who had Visual Basic 2010 auto-implemented properties may be initialized taken me home each night, for helping me establish a great career to a default value with the “= value” syntax (see Listing 2). The and a lifelong love for the art of software development. Then I compiler automatically generates a private backing field with the asked for a ride home. same name as the property but with a leading underscore. By having Software development in some version of BASIC has been a predictable backing field name, Visual Basic auto-implemented a part of my career ever since high school. Along the way I properties can be later converted to standard properties with wrote programs in other languages such as FORTRAN, Pascal, processing logic in the get or set operations. As long as the now- APL and even COBOL, but none of those languages had the explicit backing field is declared as “_propertyname,” it won’t be a natural expressiveness and ease of use of BASIC. Microsoft breaking change with the auto-implemented version of the property. continues to build on those attributes with the release of Visual Because the syntax for auto-implemented fields is so similar to Basic 10. The C# and Visual Basic language teams were merged public fields, you may be tempted to use them instead. It’s in 2008 and Visual Basic 2010 represents the first release of important to continue to use properties rather than public fields Visual Basic from the Visual Studio managed languages team. for many reasons, including data-binding, enforcing interfaces Enhancements to both C# and Visual Basic reflect the team’s and having the flexibility to change the property’s operation— commitment to co-evolution of functionality across both C# something you can’t do with a public field. and Visual Basic languages. As my first On VB column coincides with the recent release of Collection Initializers and Lambda Expressions Visual Basic 2010, Visual Studio 2010 and the Microsoft .NET Collection initializers are just that—the ability to initialize a Framework 4, I thought I’d go over the new features of Visual collection at the time of its declaration. The Add statement is Basic 2010. automatically added by the compiler for each element of the

The most striking thing when looking at Visual Basic 2010 code is the lack of line-continuation characters.

32 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Untitled-1 1 5/14/10 10:40 AM

{ ON VB }

Listing 1. Implicit Line Continuation

Visual Basic 2010 Visual Basic 2008

Dim ImplicitLineContinuation As String = Dim ExplicitLineContinuation As String = _ "This is line one, " + "This is line one, " + _ "This is line two." "This is line two."

Listing 2. Auto-Implemented Properties

Visual Basic 2010 C# 2008 and C# 2010 Visual Basic 2008

Public Property VB10Auto As String = "a" public string CSharpAuto { get; set; } Private _VB9Propery As String Public Property VB9Property() As String Get Return _VB9Propery End Get Set(ByVal value As String) _VB9Propery = value End Set End Property

Listing 3. Collection Initializers and Lambda Expressions Visual Basic 2010 Visual Visual Basic 2010 C# 2010 Dim months As New List(Of String) From Public List months = {"January", "February"} new List {"January", "February"};

collection being initialized. The Visual Basic 2010 syntax is use a derived type in place of a less-derived or parent type), and shown in Listing 3 on the left; the equivalent C# syntax is shown contravariance, which is the reverse (allowing you to use a on the right. Collection initializers are also available for more less-derived type in place of a derived type). For example, consider complex types, such as dictionaries. You can even use collection type BookStore that inherits or derives from the more general initializers with your own types, as long as you create an Add RetailStore. In the appropriate situations, covariance allows you to extension method that properly initializes an instance of your use an instance of BookStore in place of RetailStore, and contra- collection element. variance allows you to use an instance of RetailStore in place of Visual Basic 2008 introduced single-line Lambda expressions BookStore. This is one of the enhancements that is being added (functions) to support LINQ. Visual Basic 2010 supports lambda simultaneously to both C# and Visual Basic with the release of statements (subroutines) and multi-line strings. As before, a Visual Studio 2010. lambda is defined only within its current scope. The following The first statement in the following code will generate an invalid code shows a multiple-line statement lambda that displays the implicit conversion error in Visual Basic 2008 (Visual Basic 9) sum of an array of integers with a MessageBox: with Option Strict On. The same statement will work fine in Visual Basic 2010 because the interface IEnumerable is now Dim ArraySum = Sub(IntArrray() As Integer) variant, meaning that it supports covariance. The second Dim Result As Integer = 0 statement will still generate a compile error in Visual Basic 2010 For Each i As Integer In IntArrray because even though List implements the now-variant Result += i IEnumberable(Of T) interface, List is a class and is not variant: Next MessageBox.Show("Sum of Array is " + 'Generates a compile error in VB 2008 with Option Result.ToString) 'Strict On but not in VB 2010 End Sub Dim Stores As IEnumerable(Of RetailStore) = Dim SingleDigits() = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} New List(Of BookStore) 'Covariance ArraySum(SingleDigits) 'Sum of Array is 45 MessageBox 'Generates a compile error in VB 2010 with Option Covariance and Contravariance 'Strict On because List() is not variant A derived type is a type that has inherited or derived from another Dim MyStores As List(Of RetailStore) = type. Visual Basic 2010 introduces covariance (which allows you to New List(Of BookStore)

Visual Basic 2008 introduced single-line Lamba expressions (functions) to support LINQ. Visual Basic 2010 supports lambda statements (subroutines) and multi-line strings.

34 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Untitled-3 1 2/24/10 11:19 AM

{ ON VB }

Additional variant interfaces include IQueryable(of T), and increasing the application’s footprint by only the size of the IGrouping(Of TKey, TElement), IComparer(Of T) and imported types actually needed to perform the needed functions. IComparable(Of T). The Func(Of TResult), Action(Of T), For all practical purposes, this eliminates the deployment Predicate(Of T), Comparison(Of T) and Converter(Of TInput, concerns of using PIAs for COM applications. TOutput) delegates likewise have been marked variant For new applications, Type Equivalence Support is already in Visual Basic 2010. enabled. For applications upgraded to Visual Basic 2010, you need Generic delegates can now be made variant; that is, Visual Basic to enable Type Equivalence Support. For each PIA reference in the 2010 now supports variant generic delegates. Note that ByRef application, select the reference and in the Properties window, parameters can’t be marked variant. Covariant parameters are change the Embed Interop Type setting to True. Remove any PIA marked with the “Out” modifier, and contravariant parameters are deployment process you already have. It’s that easy. marked with the “In” modifier. They can be combined, but not on If you’re compiling your application via the command line, you the same parameter. See the following code for a delegate can use the /link switch instead of the /reference switch. statement that combines a covariant and contravariant parameter with the required non-variant return type: Dynamic Support Visual Basic 2010 adds late-binding support to the Dynamic Public Delegate Function Variants(Of In BookStore, Language Runtime, which offers access to objects from dynamic Out RetailStore)(ByVal param As T) As R languages such as IronPython and IronRuby. Simply create an Visual Basic 2010 Visual instance to the runtime of the desired dynamic language in order The full details of covariance and contravariance are rich topics, to access its features using standard Visual Basic syntax. and a full discussion is outside the scope of this article. For the There are also new command-line options for specifying most part, you won’t need to pay much attention to them. Code language version. With the exception of Type Equivalence Support that used to require a call to Cast(Of T) will just work now with a and the newly variant classes like IEnumerable, the enhancements more natural code appearance. The topic of covariance and listed in this article are available to the Visual Basic developer even contravariance was also covered in a C# Corner column, “Generic when targeting a prior version of the .NET runtime. Because you’ll Covariance and Contravariance in C# 4.0” (May 2009). want to do as much of your development in Visual Basic 2010 as you can, you can target an older runtime in Visual Studio by going Type Equivalence Support to your Project, right-clicking and then selecting Properties, A Primary Interop Assembly (PIA) is a vendor-supplied assembly Compile tab and Advanced Compile Options, and then selecting for a COM application that contains the type definitions or the desired target framework. metadata for a .NET application to have a more convenient and Targeting the framework in Visual Studio doesn’t limit the richer interaction with the application. Visual Basic developers are syntax to only statements that were valid at that level of the probably most familiar with the Microsoft Office PIAs that have framework. Use the /langversion command-line option to been available since Office XP. generate errors for syntax that’s valid only above the desired Microsoft strongly encourages the use of these PIAs over any framework level. For example, the following command line will COM interop assembly that’s generated by Visual Studio at design compile myclass.vb and generate errors for any syntax that’s valid time. Applications developed with the Microsoft Office PIAs have only for Visual Basic 2010: to ensure that the client has the PIAs available, either by including them in their Setup & Deployment package or ensuring that the Vbc /langversion 9.0 myclass.vb client has already installed the Redistributable PIA for the target version of Office. Previously, including these assemblies in your Visual Basic 2010 is an exciting release, and I’m happy to introduce application added megabytes of bulk, even if only a few functions it to you. Chris Parker, I’m ready for that ride home now. VSM were used. For applications deployed over the Internet, this was a significant disappointment. Joe Kunk ([email protected]) is a Microsoft MVP in Visual Basic, Microsoft has addressed the concern regarding PIA size by three-time president of the Greater Lansing User Group for .NET and senior introducing Type Equivalent Support in Visual Basic 2010 and C# developer for A. J. Boggs & Company of East Lansing, Mich. Kunk has been simultaneously. This is an under-publicized enhancement, but developing software for more than 30 years and has worked in the education, truly a tremendous boon for users of PIAs. The external types government, financial and manufacturing industries. Kunk recently used by the application—and only those types—are compiled into coauthored the book “Professional DevExpress ASP.NET Controls” (Wrox the application’s assemblies, eliminating the need to deploy PIAs Programmer to Programmer, 2009).

Visual Basic 2010 adds late-binding support to the Dynamic Language Runtime, which offers access to objects from dynamic languages such as IronPython and IronRuby.

36 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Gantt Chart

You have the vision, but time, budget and staff constraints prevent you from seeing it through. With rich user interface controls like Gantt Charts that Infragistics NetAdvantage® for .NET adds to your Visual Studio 2010 toolbox, you can go to market faster with extreme functionality, complete usability and the “Wow-factor!” Go to infragistics.com/spark now to get innovative controls for creating Killer Apps.

Infragistics Sales 800 231 8588 Infragistics Europe Sales +44 (0) 800 298 9055 Infragistics India +91-80-6785-1111 twitter.com/infragistics

Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics, the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc. All other trademarks or registered trademarks are the property of their respective owner(s).

Untitled-12 1 4/9/10 1:55 PM DynamicPDF…Proven .NET Components for Real-Time PDFs

Easy-to-use Highly efficient Industry leading support Huge feature set 4RYIT&2%%TODAY Layout reports in DynamicPDF Designer with its Visual Studio look and feel. %XPERIENCEOURFULLYFUNCTIONAL NEVEREXPIRINGEVALUATION ANDCOMMUNITYEDITIONS DynamicPDF Generator v6.0 for .NET $YNAMIC0$&3UITEVFOR.%4 s,INEARIZE&AST7EB6IEWs*AVA3CRIPT /UREASY TO USETOOLSINTEGRATEWITH!30.%4 s%NCRYPTION3ECURITYs0$&8 As0$&! AB AND!$/.%4ALLOWINGFORTHEQUICK REAL TIME s#REATE4AGGED0$&Ss)NTERACTIVE&ORM&IELDS GENERATIONOF0$&DOCUMENTSANDREPORTS s/VER2EADY 4O 5SE0AGE%LEMENTS)NCLUDING "AR#ODESAND#HARTINGs$IGITAL3IGNATURES &OREASYMAINTENANCEANDDEPLOYMENT OURMOSTPOPULARTOOLSARENOWAVAILABLE ASABUNDLEDSUITE $YNAMIC0$&-ERGERVFOR.%4 s-ERGEs3TAMPs!PPENDs3PLITs0ASSWORD3ECURITY s&ORM &ILLs/UTLINEAND!NNOTATION0RESERVATION s0LACE 2OTATE 3CALEAND#LIP0AGESs$ECRYPTION

$YNAMIC0$&2EPORT7RITERVFOR.%4 s'5)2EPORT$ESIGNERs%VENT$RIVENs2ECURSIVE3UB 2EPORTS s5SE0$&4EMPLATESs!UTOMATIC0AGINATIONs0LACEHOLDERS s2ECORD3PLITTINGAND%XPANSIONs#OLUMN3UPPORT s&ULL$YNAMIC0$&-ERGERAND'ENERATOR)NTEGRATION

!LSO CHECKOUTOURNEWESTPRODUCT $YNAMIC0$&0RINT-ANAGERFOR.%4.

ceTe Software has been delivering quality software applications and components to our customers for over 10 years. Our DynamicPDF product line has proven our commitment to delivering innovative software components and our ability to respond to the changing needs of software developers. We back our products with a first class support team trained to provide timely, accurate and thorough responses to any support needs.

Untitled-1 1 3/15/10 11:50 AM Advertising Sales Ad Index

ID Statement Advertiser Page East Visual Studio Magazine (ISSN 1537-002X) is /n Software Inc. 5 Matt Morollo published monthly by 1105 Media, Inc., 9201 Oakdale www.nsoftware.com VP, Publishing Avenue, Ste. 101, Chatsworth, CA 91311. Periodicals Phone: 508-532-1418 Altova 17 postage paid at Chatsworth, CA 91311-9998, and at www.altova.com [email protected] additional mailing offi ces. Complimentary subscrip- Aspose C4 tions are sent to qualifying subscribers. Annual www.aspose.com West subscription rates for non-qualifi ed subscribers are: ceTe Software 38 Chris Kourtoglou U.S. $34.97, Canada $52.97 (U.S. funds); Interna- www.cete.com tional $78.97 (U.S. funds). Subscription inquiries, Regional Sales Manager dtSearch 29 back issue requests, and address changes: Mail www.dtsearch.com Phone: 650-787-9515 to: Visual Studio Magazine, P.O. Box 2166, Skokie, IL ESRI, Inc. 15 [email protected] 60076-7866, email [email protected] or call www.esri.com toll free (888) 768-8759, fax number 847-763-9564. GrapeCity FarPoint C3 www.fpoint.com International calls 847-763-9135. POSTMASTER: National Accounts Director Send address changes to Visual Studio Magazine, Infragistics C2, 1, 19, 25, 37 www.infragistics.com William Smith P.O. Box 2166, Skokie, IL 60076-7866. Canada Phone: 603-886-3466 LEAD Technologies, Inc. 7 Publications Mail Agreement No: 40612608. Return www.leadtools.com [email protected] Undeliverable Canadian Addresses to Circulation Dept. Microsoft Corporation 2, 20, 21, 27 or IMS/NJ. Attn: Returns, 310 Paterson Plank Road, www.microsoft.com Carlstadt, NJ 07072. Programmer’s Paradise 11 Microsoft Account Manager www.programmersparadise.com Danna Vedder Copyright Statment SharePoint Live! 33 Phone: 253-514-8015 © Copyright 2009 by 1105 Media, Inc. All rights http://vslive.com dvedder@11 05media.com reserved. Printed in the U.S.A. Reproductions in whole TechExcel, Inc. 35 www.techexcel.com or part prohibited except by written permission. Mail requests to “Permissions Editor,” c/o Visual Studio VSLive! 30, 31 http://vslive.com Director, Print Production Magazine, 230 California St. Suite 302, San Francisco, Jenny Hernandez-Asandas CA 94111. Phone: 818-814-5289 Editorial Index Fax: 818-734-1528 Legal Disclaimer The information in this magazine has not under- Apple Inc. 40 [email protected] www.apple.com gone any formal testing by 1105 Media, Inc. and is Production Coordinator DataViz Inc. 40 distributed without any warranty expressed or implied. www.dataviz.com Serena Barnes Implementation or use of any information contained Phone: 818-814-5367 E·Sponder LLC 12 herein is the reader’s sole responsibility. While the www.e-sponder.com [email protected] information has been reviewed for accuracy, there is Google Inc. 40 [email protected] no guarantee that the same or similar results may be www.google.com achieved in all environments. Technical inaccuracies Hewlett-Packard Co. 40 may result from printing errors and/or new develop- www.hp.com ments in the industry. Infragistics 18 www.infragistics.com Corporate Address OpenOffi ce.org 40 www.openoffi ce.org Corporate Headquarters: Palm Inc. 40 110511 Media www.palm.com 929201 Oakdale Ave. Ste 101, Chatsworth, CA 91311 Parametric Technology Corp. 14 wwww.1105media.com www.ptc.com Research In Motion Ltd. 40 MediaM Kits www.rim.com DirectD your Media Kit requests to Matt Morollo, VP SAP AG 14 Publishing,Pu 508-532-1418 (phone), 508-875-6622 www.sap.com (f(fax), [email protected] Spanish Point Technologies Ltd. 14 www.spanishpoint.ie ReprintsR ForFo single article reprints (in minimum quantities of 25250-500), e-prints, plaques and posters contact: PARSPA International Phone:Ph 212-221-9595 E-mail:E- [email protected] www.magreprints.com/QuickQuote.aspw

ListL Rental This publication’s subscriber list, as well as other lists Media Kits from 1105 Media, Inc., is available for rental. For more Direct your Media Kit requests to Matt Morollo, information, please contact our list manager, Merit VP Publishing, 508-532-1418 (phone), Direct. Phone: 914-368-1000; E-mail: 1105media@ GO TO 508-875-6622 (fax), [email protected] meritdirect.com; Web: www.meritdirect.com. VisualStudioMagazine.com to access the stories in this issue, plus read exclusive online-only content.

VisualStudioMagazine.com · June 2010 · VISUAL STUDIO MAGAZINE 39 BY ANDREW J. BRUST

Offi ce Alternatives

Microsoft Offi ce 2010, the new version of Redmond’s fl agship Offi ce market share. They off er features Offi ce doesn’t: iWork for the productivity suite, off ers great value through important new features. iPad has a touch-oriented UI; Google Docs is easy to use when you’re But we’re now on version 14 of a product whose origins go back online, especially if you’re not on your own PC; and Documents To Go more than 25 years. How can Microsoft keep turning out new Offi ce works across Windows Mobile, Android, iPhone and BlackBerry devices. versions and continue to realize cash cow-sized revenue? Microsoft can do it, but only if it changes its Offi ce game in fundamental ways. Going SOHO To a large extent, Offi ce is two products. On the one hand, it’s a In response, I think Microsoft needs a dedicated SOHO product, not consumer and small business off ering with basic word processing, just a new Offi ce SKU. The company needs to give it commodity spreadsheet, presentation and e-mail capabilities. Let’s call this features and a price to match; it must also align the new product’s manifestation of the product “Offi ce SOHO” (small ce/homeoffi fi le format with Offi ce, both for compatibility and to leverage the offi ce). On the other hand, Offi ce is an enterprise productivity suite brand. Furthermore, Microsoft needs to create a touch-friendly providing publishing, business intelligence, unifi ed communications, version of this product. It could be based on the version of Offi ce Web conferencing, forms processing, note-taking and collaboration being developed for Windows Phone 7 (WP7), and could be destined features. Let’s call this interpretation of the suite “Offi ce Corporate.” to run on Microsoft OS tablet devices—which might also be based on These two faces of Offi ce make the product versatile, but they WP7 technology. Beyond the Windows orbit, Microsoft should create a huge PR problem for Microsoft. Offi ce Corporate—and its consider creating versions for Android, iPad, iPhone and the HP/Palm upgrades—provide huge value, but the product is often reviewed, webOS. And the Offi ce Web Apps story should align with this initiative. analyzed and criticized from the SOHO perspective, where If Microsoft did this, it could win the hearts and minds of upgrades seem superfl uous, pricing looks high, and Web-based bloggers and analysts, the loyalty of consumers and the interest of competitors seem just as good, if not better. This perception on the OEMs. This could help Redmond gain real momentum on the SOHO front impacts the Corporate zone, too. infl uencer front, where there have been few wins recently. Would the new SOHO product cannibalize sales of the full Offi ce SKU Confusion suite? Perhaps, but I tend to think that it would instead preserve— Why the one-sided set of criteria? Many tech analysts, bloggers even enhance—the Enterprise Agreement channel for Offi ce and journalists use the SOHO feature set and tend to work on Corporate. It might even shorten the deployment cycle for new non-corporate computing platforms. This is true of increasing versions in large enterprises, which is now as long as three years. numbers of consumers, as well. Offi ce Corporate is invisible to them. Shorter deployment cycles would mean innovative new features Offi ce SOHO seems long in the tooth and even longer on price. like PowerPivot could provide value sooner, which would further Microsoft has a consumer productivity suite called Works, which has preserve and enhance the franchise. often been bundled with consumer PCs. It’s cheap, capable (in that Just because a product has passed the quarter-century mark “good enough” way) and relatively simple and straightforward to use. doesn’t mean the romance must be over. Ask a couple celebrating a But most people use Offi ce at work and prefer its functionality and le fi silver anniversary, and they might agree—but they might also say formats. Plus, there’s signifi cant expense and complexity for Microsoft you have to spice things up to keep it interesting. And that’s good in maintaining two productivity suites. So Microsoft has announced prescriptive guidance for Microsoft and Offi ce. VSM that Works is going away, and Offi ce 2010 Starter Edition—a SKU off ered exclusively on new PCs—is, essentially, its replacement. Andrew J. Brust ([email protected]) is chief of new technology for Meanwhile, a growing number of customers use OpenOffi ce.org, consultancy twentysix New York, as well as a Microsoft regional director and Google Docs and Apple iWork. These products (even glorifi ed MVP. He’s also the coauthor of “Programming Microsoft SQL Server 2008” smartphone fi le viewers like DataViz Documents To Go) are eroding the (Microsoft Press, 2008).

I think Microsoft needs a dedicated SOHO product, not just a new Office SKU.

40 VISUAL STUDIO MAGAZINE · June 2010 · VisualStudioMagazine.com Untitled-7 1 5/6/10 3:24 PM Untitled-1 1 4/28/10 11:21 AM