VisualStudioMagazine.com MAGAZINE

EXPERT SOLUTIONS FOR .NET DEVELOPMENT

The Making of Visual Studio 2010 A look behind the development of ’s game-changing IDE.

PLUS Cloud Development in Visual Studio 2010 Scaled-Down Code Generation APRIL 2010 Volume 20, No. 4 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 Your best source for software development tools! ®

LEADTOOLS Recognition Multi-Edit 2008 VMware vSphere SDK v16.5 by Multi Edit Software Put time back into your day. by LEAD Technologies Multi-Edit 2008 delivers, a powerful IDE, Your business depends on how you spend Develop robust 32/64 bit document with its speed, depth, and support for your time. You need to manage IT costs imaging and recognition functionality into over 50 languages. Enhanced search without losing time or performance. With your applications with accurate and functions include Perl 5 Regular proven cost-effective virtualization solutions high-speed multi-threaded Forms, OCR, Expressions and definable filters. from VMware, you can: OMR, and 1D/2D barcode engines. Supports large DOS/Windows, UNIX, • Increase the productivity of your existing VMware binary and Mac files. File Sync staff three times over • Supports text, OMR, image, and Advanced barcode fields Integration for: Delphi 6, 7, 2005, C++ • Control downtime—whether planned Acceleration Kit • Auto-registration and clean-up to Builder 6, BDS 2006 and Rad Studio or not improve recognition results 2007, VB 6, VC 6, VS 2003, 2005 1-49 Users for 6 processors • Provided as both high and low and 2008. Includes file compare, code Paradise # • Save more than 50% on the cost of Paradise # level interface managing, powering and cooling servers V55 78101A01 Paradise # beautifying, command maps, and A30 01201A01 • Includes comprehensive confidence much more. L05 26301A01 $ 99 Make your time (and money) count for $ 99 reports to assess performance 179. more with virtualization from VMware. 9,234. $ 99 3,214. programmers.com/LEAD programmers.com/multiedit programmers.com/vSphere Pragma Fortress SSH—SSH CA ERwin® Data Modeler Server & Client for Windows r7.3 – Product Plus 1 Year BUILD ON by Pragma Systems Enterprise Maintenance VMWARE ESXi Contains SSH, SFTP, SCP servers and clients by CA AND VSPHERE for Windows. CA ERwin Data Modeler is a data modeling for Centralized Management, • Certified for Windows Server 2008R2 solution that enables you to create and maintain databases, data warehouses Continuous Application • Compatible with Windows 7 Availability, and Maximum • High-performance servers with and enterprise data resource models. These models help you visualize data Operational Efficiency in Your Certified centralized management structures so that you can effectively for Windows • Active Directory & GSSAPI authentication Virtualized Datacenter. organize, manage and moderate data 7/2008R2 • Supports over 1000 sessions Programmer’s Paradise invites you to take advantage complexities, database technologies of this webinar series sponsored by our TechXtend • Offers FIPS mode and the deployment environment. Paradise # P26 04201E01 solutions division. Paradise # • Hyper-V and PowerShell support P35 04201A01 • Runs in Windows 2008R2/2008/2003/7/ $ 99 FREE VIRTUALIZATION WEBINAR SERIES: Vista/XP/2000 3,951. $ 99 REGISTER TODAY! TechXtend.com/Webinars 550. programmers.com/pragma programmers.com/ca ActiveReports 6 Orion Network TX Text Control 15.1 by GrapeCity Performance Monitor Word Processing Components NEW RELEASE! Integrate Business Intelligence/Reporting/Data by Solarwinds TX Text Control is royalty-free, Analysis into your .NET applications using the Orion Network Performance Monitor is a robust and powerful word processing NEW ActiveReports 6. comprehensive fault and network performance software in reusable component form. • Fast and Flexible reporting engine management platform that scales with the • .NET WinForms control for VB.NET and C# rapid growth of your network and expands • ActiveX for VB6, Delphi, VBScript/HTML, ASP • Data Visualization and Layout Controls such with your network management needs. as Chart, Barcode and Table Cross Section It offers out-of-the-box network-centric views • File formats DOCX, DOC, RTF, HTML, XML, TXT NEW Controls that are designed to deliver the critical • PDF and PDF/A export, PDF text import Professional Edition VERSION Paradise # 6! • Wide range of Export and Preview formats information network engineers need. • Tables, headers & footers, text frames, including Viewer, Web Orion NPM is the easiest product of its T79 02101A02 Paradise # bullets, structured numbered lists, multiple Professional Ed. Viewer, Adobe Flash and PDF kind to use and maintain, meaning you undo/redo, sections, merge fields, columns $ 99 will spend more time actually managing S4A 08201E02 Paradise # • Royalty-Free Licensing for Web and • Ready-to-use toolbars and dialog boxes 848. networks, not supporting Orion NPM. $ 99 D03 04301A01 Windows applications 4,606. Download a demo today. $ 99 1,310. programmers.com/grapecity programmers.com/solarwinds programmers.com/theimagingsource AdminStudio & Application DON’T BE LEFT BEHIND! STAY ON THE CUTTING EDGE OF TECHNOLOGY: Virtualization Pack NEW! MICROSOFT® VISUAL STUDIO® 2010 MAKES IT EASY! by Flexera Software One Application Software Deployment Tool • Set your ideas free—Create what you can imagine, for Reliable MSI Packaging, Application build on the strengths of your team, and open up new Virtualization, and Windows 7 Migration. possibilities! Top choice of Microsoft®, Novell®, LANDesk® • Simplicity through integration—A single integrated and other software management solutions. development environment that takes your skills further and Cut MSI packaging time by up to 70%, adjusts to the way you work. Professional Deploy software to desktops with 99% • Quality tools help ensure quality results— Upgrade from success or better. AdminStudio is the only 2010 Powerful testing tools with proactive any Active AS MSI packaging solution to support multiple features help you build the right app the right way. Pro + Silver Mtn virtualization formats, including Microsoft® Paradise # App-V™, VMware® ThinApp™ and ® ™ DISCOVER 2010... I21 09401S05 Citrix XenApp . TAKE YOUR DEVELOPMENT TEAM TO THE NEXT LEVEL! $ 99 4,228. programmers.com/flexera Call your Programmer’s Paradise Representative Today! 866-719-1528 programmersparadise.com Prices subject to change. Not responsible for typographical errors.

Untitled-2 1 3/4/10 9:59 AM { FRAMEWORKS }

April 2010 // Volume 20 // No. 4

Michael Desmond, Editor in Chief, Visual Studio Magazine Big Changes By almost any metric, Visual Studio 2010 is a big release. The new IDE features extensive changes to the Visual Studio code editor and designer; improved support for platforms like Windows Azure, Silverlight and SharePoint; and welcome refi nements to the Visual Studio application lifecycle management stack. In fact, it could be the FEATURES biggest update to the IDE since Visual 14 The Making of Visual Studio 2010 Studio .NET shipped in 2002. With the ambitious nature of the Visual Studio 2010 upgrade, it’s hardly As Dave Mendlen, senior director of surprising Microsoft faced challenges on its way to RTM. We take a look behind Developer Marketing at Microsoft, told me the development of Microsoft’s game-changing IDE. in an interview for this month’s cover BY MICHAEL DESMOND feature (“The Making of Visual Studio 2010,” p. 14), working on the project was a 20 Using Visual Studio 2010 to Build Cloud Services and Applications true high-wire act. “Imagine a platform Visual Studio 2010 provides familiar tooling and resources for developers who that’s changing in real time, and you’re want to put their applications up in the cloud. Here’s how to do it. trying to tool it while it’s moving. You’re BY JIM NAKASHIMA, HANI ATASSI, DANNY THORPE AND ANSON HORTON literally trying to build the plane as it’s fl ying and keep it in the air,” he said. 28 The Evolution of Visual C++ in Visual Studio 2010 Hey, don’t let anyone tell you that C++ developers will see major improvements in Visual C++ 2010 beyond support Mendlen doesn’t know how to have a good for Windows 7 . Find out how the new language features, updated libraries time. His team at Microsoft has been fl at and tools can improve your developer experience. out the past couple months, producing an BY SUMIT KUMAR impromptu release candidate to address issues in the beta 2 code. As if that weren’t 33 LANGUAGE LAB enough, Mendlen pushed through a Ask Kathleen PAGE 33 wholesale restructuring of the bloated Scaled-Down Code Generation Visual Studio SKU profi le. Unable to make a broad commitment to code generation? Explore new ways Mendlen also got busy writing the to use T4 code generation in the Microsoft .NET Framework as a localized inaugural VSInsider column in this month’s development tool for small projects and unique architectures. issue. The new column refl ects Microsoft’s BY KATHLEEN DOLLARD increased participation in Visual Studio Magazine. Each month, a member of the DEPARTMENTS Visual Studio team or other insider will 6 Letters to the Editor off er insight into the workings of the dev team and provide a timely heads-up on 8 DevInsight DEVELOPER NEWS, VSTOOLBOX, VSINSIDER emerging tools and technologies. Microsoft News: Plugged in to Visual Studio 2010 PAGE 8 will also contribute regular how-to features, VSToolbox: Managing Projects with Axosoft OnTime PAGE 10 starting with this month’s explorations of VSInsider: Get Ready for Visual Studio 2010 PAGE 12 Windows Azure- and C++-based development in Visual Studio 2010. 39 Index of Advertisers There’s a lot going on, and more to come as we work with Microsoft to improve COLUMNS our coverage of the fast-changing .NET 3 Frameworks BY MICHAEL DESMOND developer space.

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

VisualStudioMagazine.com · April 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

Routing in ASP.NET 4 Windows Server AppFabric Hits Top Software Security Coding Errors BY PETER VOGEL ‘Feature Complete’ Milestone BY JABULANI LEFFALL ASP.NET 4 makes it easier than ever to BY KATHLEEN RICHARDS A new study describes the top 25 support URL addresses that actually mean Beta 2 adds hosting and management programming errors that can open up something, rather than just describing the functionality, enhances cache services security holes in software. The free report path to the page. Learn how to implement and improves the persistence subsystem, lists oversights that can lead to denial-of- this for your site in the fi rst segment of which is designed to store the workfl ow service attacks, data theft or control of a this two-part article. state and enable “durable” workfl ows, system by hackers. according to Microsoft. VisualStudioMagazine.com/Vogel0410 ADTmag.com/Leffall0410 RedDevNews.com/Richards0410A Microsoft Releases Preview of U-Prove Ballmer: Microsoft Bets on the Cloud BY JOHN K. WATERS Runtime Repository for Visual Studio BY KURT MACKIE Microsoft acquired U-Prove two years 2010 Dotfuscator Suite Microsoft is reshaping its business around ago from Montreal-based privacy vendor BY KATHLEEN RICHARDS cloud computing. Nearly 70 percent of Credentica Inc. Developed by the company’s PreEmptive Solutions LLC released an Microsoft’s 40,000 software builders are founder, U-Prove is an encryption and open source Runtime Intelligence Endpoint either working on something associated with authentication system designed to allow Starter Kit on Microsoft CodePlex, which is the cloud or working on projects designed users to conduct secure digital transactions aimed at early adopters of its Dotfuscator to support the company’s cloud-computing through a process called selective disclosure. Software Services in Visual Studio 2010. initiatives. Within a year, that fi gure will be 90 percent, CEO Steve Ballmer said. VisualStudioMagazine.com/Waters0410 RedDevNews.com/Richards0410B ADTmag.com/Mackie0410 New Architecture Tools Red Gate Launches .NET Refl ector Pro BY MICKEY GOUSSET BY KATHLEEN RICHARDS Hedge Fund Makes Bid for Novell The architecture tools in Visual Studio 2010 Red Gate Software Ltd. released the latest BY JEFFREY SCHWARTZ Ultimate have undergone a radical version of .NET Refl ector 6.0.0, which adds A New York-based hedge fund has made transformation. Support for Unifi ed Modeling support for the Microsoft .NET Framework 4 an unsolicited bid to acquire Novell for Language 2.1.1 diagrams has been added, and Visual Studio 2010. The company also nearly $2 billion in cash. The bid for Novell as well as new tools and diagrams to help debuted .NET Refl ector Pro, a Visual Studio sparked speculation that perhaps Microsoft, you understand your application, such as the add-in that debugs third-party assemblies, Cisco Systems Inc. or Hewlett-Packard Co. Architecture Explorer and Dependency Graphs. even without access to the source code. may also jump into the bidding.

VisualStudioMagazine.com/Gousset0410 RedDevNews.com/Richards0410C ADTmag.com/Schwartz0410

VisualStudioMagazine.com RedDevNews.com ADTmag.com

4 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Visit LEAD: Booth #521 at the Microsoft Visual Studio Launch Expo In Las Vegas .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-3 1 3/5/10 3:46 PM MAGAZINE

EXPERT SOLUTIONS FOR .NET DEVELOPMENT

VisualStudioMagazine.com Letters April 2010 • Volume 20 • No. 4 Editorial Staff Vice President, Doug Barney Editorial Director Editor in Chief Michael Desmond LINQed In Executive Editor Kathleen Richards In the March C# Corner column (“Using LINQ to Express Intent”), Patrick Steele Managing Editor Wendy Gonchar Associate Managing Editor Katrina Carrasco explained how to use LINQ outside of databases to make code easier to read and maintain. Tools Editor Peter Vogel

Good article. I’m wondering, though, about the performance implications here. Will Contributing Editors Andrew J. Brust, Ken Cox, Kathleen Dollard, using LINQ to do some of these things be less effi cient? I’m not sure what’s Roger Jennings, Jeff Levinson, Bill McCarthy, happening under the covers, for example, when I do .Skip(1) rather than just Karl E. Peterson, Keith Pleas, Bill Wagner, Dan Wahlin, John K. Waters looping starting at index 1. Craig Fisher Art Staff Seattle, Wash. Creative Director Scott Shultz Art Director Joshua Gould Submitted via Internet Online/Digital Media I just fi nished reading this article this morning. It was well written, made the case Director, Online Media Becky Nagel for expressing intent with LINQ very well, and I even learned a new thing or two. Executive Editor, New Media Michael Domingo Site Administrator Shane Lee Excellent work. Designer Rodrigo Muñoz Patrick Submitted via Internet

Nesting in Visual Basic President Henry Allain Karl E. Peterson got developers’ attention with his online Classic VB column Vice President, Publishing Matt Morollo Director of Marketing Michele Imgrund (“Creating Nested Folders,” February 2010), which told readers how to skip the Online Marketing Director Tracy Cook single API call and instead build nested folder directories with native code.

We’ve been using the API function Private Declare Function MakeSureDirectory- PathExists Lib “IMAGEHLP.DLL” (ByVal DirPath As String) As Long, which creates President & Neal Vitale Chief Executive Offi cer the desired folder all in one hit. Senior Vice President Richard Vitale Mark Williams & Chief Financial Offi cer United Kingdom Executive Vice President Michael J. Valenti Submitted via Internet Vice President, Finance Christopher M. Coates & Administration [The] algorithms in this code will be useful for Visual Basic 2008 and C# as well. Vice President, Digital Media, Abraham M. Langer Although the VisualBasic.My NameSpace will create nested directories, the Audience Development standard .NET Framework doesn’t have the ability to create nested directories in Vice President, Information Erik A. Lindgren Technology & Web Operations a single call. Mike Chairman of the Board Jeff rey S. Klein Submitted via Internet

FileSystemObject isn’t part of the Visual Basic 6 language—it’s an external REACHING THE EDITORS Editors can be reached via e-mail, fax, telephone or mail. dependency, and sometimes IT administrators disable it in their zeal for security. A list of editors and contact information is available at In my opinion it’s best avoided, especially when you can easily do fi le and directory VisualStudioMagazine.com. E-mail: E-mail is routed to individuals’ desktops. Please use manipulation in pure Visual Basic 6. the following form: [email protected]. Mark J. Do not include a middle name or middle initials. Submitted via Internet Telephone: The switchboard is open weekdays 8:30 a.m. to 5:30 p.m. Pacifi c Time. After 5:30 p.m. you will be directed to individual extensions. San Francisco Offi ce 415-814-0950; Fax 415-814-0961 Irvine Offi ce 949-265-1520; Fax 949-265-1528 Corporate Offi ce 818-734-1520; Fax 818-734-1528

Visual Studio Magazine wants to hear from you! Send us your thoughts Visual Studio Magazine about recent stories, technology updates or whatever’s on your mind. The opinions expressed within the articles and other contents herein do not necessarily express those of the publisher. E-mail us at [email protected] and be sure to include your first and last name, city and state. Please note that letters may be edited for form, fit and style. They express the views of the individual authors, and do not necessarily reflect the views of the VSM editors or 1105 Media Inc.

6 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Project3 12/16/09 11:55 AM Page 1 DEVELOPER NEWS /// VSTOOLBOX /// VSINSIDER

DEVELOPER NEWS

stores the extension and metadata about the extension— including manifest and payload—in a standard .ZIP fi le. VSIX is part of the new Extension Manager in Visual Studio 2010 that lets developers manage extensions and share code templates, for example, in the Visual Studio Gallery from a menu within Visual Studio 2010. The Extension Manager supports MEF components, VSPackages, project templates and item templates. With the new extensibility model, many developers

New are concerned about having to rewrite existing add-ins as extensions in Visual Studio 2010. “For Visual Studio 2010, the VSIX format supports Extension Model Extension VSPackages, MEF Components, Project Templates, Item Plugged in to Templates, Template Wizards, Toolbox Controls and custom extensions, [such as] extensions to a third-party Visual Studio 2010 extension,” explained Gearard Boland, a developer on What does the new .NET extensibility model mean for your existing add-ins? Microsoft’s Visual Studio Platform team, in response to a similar question on an MSDN forum in February. “It does not support add-ins, Code Snippets and other extension BY KATHLEEN RICHARDS types not listed in the previous point. VSIX also allows you to include With powerful advances in recent years—the Visual Studio 2005 assemblies and other resources that your extension requires in their automation model and the Visual Studio 2008 Shell—Microsoft has payload and will install them next to your extension component.” increased support for customization of its integrated development Boland continued: “The benefi t of switching to a VSIX-supported environment by off ering developers broader extensibility. The .NET extension type is that you can take better advantage of the deploy- extensibility model in Visual Studio 2010 takes it a step further. ment and discoverability aspects that we delivered in Visual Studio The code editor and shell, rebuilt using managed code, enable 2010 via the Extension Manager and Visual Studio Gallery integration.” new extensibility based on the Windows Presentation Foundation Even so, add-ins based on the Automation object model in Visual (WPF) graphics subsystem and extensible objects from the Studio (EvuDTE) and toolbar (Microsoft.VisualStudio.CommandBars) Managed Extensibility Framework (MEF) libraries, on which it’s still work in Visual Studio 2010, but developers may have to employ built. Part of the Microsoft .NET Framework 4 and Silverlight 4, MEF workarounds. That was the experience of Carlos Quintero, a lets developers build tools around extension points—content types, Microsoft MVP, who updated his MZ-Tools 6.0 add-in to support classifi cation types, drop handlers, tags, adornments, margins/ Visual Studio 2010 RC. “Microsoft fi nally fi xed most of the bugs scrolling and IntelliSense—using MEF components (parts), without that I’ve been reporting in the last months in the WPF-based implementing a package. CommandBars, so add-ins can get loaded in the IDE without crashing,” PreEmptive Solutions LLC, provider of the .NET obfuscator called he wrote in his blog in March. “As far as I’m concerned, I was able to Dotfuscator and related services in Visual Studio 2010, used the new work around all the issues that were not fi xed—and won’t be in the extensibility framework to “mash up” usage data generated from its release to manufacturing.” Runtime Intelligence Service with test data inside of the Visual The updated MZ-Tools is compiled in Visual Studio 2008 against Studio 2010 Ultimate Architect Explorer. .NET 2.0. Quintero explained: “I have done tests for future versions “We took something Microsoft had already done—they color-coded and it seems to be possible to build a single assembly in the .NET the nodes in Architect Explorer to show code coverage—[and] we Framework 2.0/CLR 2.0 that targets Visual Studio 2005, 2008 and folded in the usage data from Runtime Intelligence to change the 2010, using references provided by Visual Studio 2005 (that are size of the node, so you saw an immediate heat-map gap between also available in next Visual Studio versions), or using Refl ection for code coverage and actual usage,” explains Sebastian Holst, chief references whose version changes between IDE versions. (I think marketing offi cer at PreEmptive Solutions. He says the integration that you can use assembly redirections, too.)” points in 2010 are very exciting for developers. Early adopters of Visual Studio 2010 test builds have also noticed that some adjustments may be needed to successfully VSIX Files migrate add-ins that make use of certain toolbar features. Microsoft Visual Studio 2010 also introduces VSIX deployment, a container model has confi rmed that developers will need to move to packages for for extensions that’s based on the Open Packaging Convention (OPC). toolbar functionality such as ComboBoxes. VSM OPC is used in the Microsoft Offi ce System Open XML specifi cation, which is supported in Offi ce 2007 apps and other Microsoft software. It Kathleen Richards ([email protected]) is executive editor of VSM.

8 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Project1 10/30/09 2:58 PM Page 1

ESRI® Developer Network 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 (EDN SM), 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 © 2009 ESRI. All rights reserved. The ESRI globe logo, ESRI, 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.

VSToolbox

Managing Projects OnTime Professional

with Axosoft OnTime Axosoft LLC OnTime is a tremendously capable project management system that’s good—but not Web: www.axosoft.com perfect—when supporting Visual Studio developers. Phone: 800-653-0024 Price: OnTime Professional is OnTime BY PETER VOGEL Connect with Customers $795 for five users installed, $79 a OnTime is a feature-rich project manage- OnTime Professional’s default customer month hosted

Axosoft ment system designed specifically for portal allows access to project information Quick Facts: Software project- software projects. The product understands for up to five named customers and an management with a hosted option a world where project stakeholders are unlimited number of anonymous users (you and Visual Studio integration connected by the Internet rather than can add more users for an additional fee). Pros: Lots of functionality, easy to geography. You can install OnTime on your This allows your customers to view and use, strong support for distributed local area network, or you can also choose to update project information without having teams and other stakeholders let Axosoft host your project management to bother you. The configurable notification Cons: No support for remote Visual solution. If you choose to install, a remote system lets you keep remote members of the SourceSafe connections, integration server option lets developers not on your team and other stakeholders integrated with Visual Studio could be improved local network link to OnTime. through e-mail or wiki page updates when Setting up a project in OnTime is quick, information in the project changes. easy and intuitive. An OnTime project is a OnTime integrates with Visual Studio Studio Solution or a file in a solution, I flexible construct that can encompass through a dockable window (Figure 1). should automatically see the tasks that I’m multiple Visual Studio projects and include OnTime also ties into source control so you assigned to that are related to those files. And tasks, features, defects and other projects. can assign files to tasks, check items in or when I select a task in the OnTime window, I The reporting system provides a wide variety out from OnTime dialogs, and update should have the option to open the related of ways to view a project’s status, plan items’ statuses when checking them in. files in Visual Studio. Even with these items schedules, view workloads, and keep track of From the point of view of the lone on my wish list for Visual Studio integration, project commitments and deliverables. developer or manager of a small consulting I’d consider adopting OnTime. VSM OnTime tasks can be associated with items in firm, OnTime has a lot going for it. The your source-management control system. pay-as-you-go monthly plan for the hosted Peter Vogel ([email protected]) is a principal in The one stumbling block I ran into occurred option means that you don’t have to spend PH&V Information Services, specializing in ASP.NET when I tried to use VSSConnect to connect capital dollars to get a sophisticated development with expertise in SOA, XML, database to a remote copy of Visual SourceSafe, which project-management tool. The installation and UI. His most recent book, “rtfm*: The Little Book OnTime did not support. is minimal for the hosted service, so you on How to Write So You’ll Actually Get Read” can be setting up projects (PH&V Information Services, 2008), is on writing in a few minutes. effective user manuals; his blog on technical writing OnTime’s integration can be found at rtfmphvis blogspot.com. with Visual Studio is admirable: Developers can perform most OnTime- ToolTracker related tasks from the OnTime window without New at VSM: ToolTracker leaving Visual Studio. Full Starting this month, VSM tools integration would provide editor Peter Vogel will be publishing more, however. The task list regular Web updates about new in the OnTime window developer tools and products, should show just the tasks and following up on previously Figure 1. The OnTime window allows you to see all tasks to that I’m assigned to without reviewed products. Check it out at which you’re assigned. You can add, remove or update tasks having to filter the list. VisualStudioMagazine.com. without leaving Visual Studio. When I open a Visual

10 VISUAL STUDIO MAGAZINE · April 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 Copyright 1996-2010 Infragistics, Inc. All rights reserved. Infragistics and the Infragistics logo and NetAdvantage are registered trademarks of Infragistics, Inc.

Untitled-6 1 1/8/10 3:26 PM

VSInsider

Get Ready for Visual Studio 2010

and love. Ever since Visual Basic 1.0, to call it—helps end the scourge of non- Microsoft has aimed to bring developers reproducible bugs. IntelliTrace records an rich integration support. In Visual Studio application’s execution history so you can 2010, you’ll see support for Windows 7, quickly reproduce reported bugs. These SharePoint 2010, Windows Azure and IntelliTrace features are just a handful of the Launch much, much more. Because Visual Studio is hundreds of improvements we’ve made to built on the .NET Framework, you’ll be able help with application lifecycle management. Visual Studio 2010 Visual to extend and transfer your existing skills to Throughout the development phase new technologies, providing flexibility and we’ve taken customer feedback very power. In this next release, we’ve strived to seriously, and we’re excited to deliver a deliver something for every developer. high-quality product on launch day. We As a reader of VSM, you’ve probably now offer three flavors of Visual Studio: noticed significant improvements to the Professional, Premium and Ultimate, coding experience. We re-plumbed the and each comes with its own MSDN environment in Windows Presentation subscription. To see what version will best BY DAVE MENDLEN Foundation (WPF) and added multi- suit your development needs, visit [Welcome to the new VSInsider column. Each monitor support. Now, you can have one Microsoft.com/visualstudio. month, a member of the Visual Studio team monitor with code, another with the UI and Here at Microsoft, the Visual Studio at Microsoft will provide insight on emerging yet another with database structure. This is team is excited to see how developers like developer technologies and provide a glimpse just one of the features we’ve added in Visual you will use this release to build amazing inside the developer division.—Ed.] Studio 2010 to make coding fun again. applications. What mind-blowing applica- This is an exciting month for developers. We’ve also made sure that functionality tions will you create? Download the As we approach the Visual Studio 2010 in Visual Studio 2010 addresses the latest Visual Studio 2010 trial at Microsoft.com/ launch on April 12, we’re working overtime Microsoft releases, be it support for visualstudio, and start turning your ideas to give developers the information Windows 7 multi-touch and Ribbon inter- into solutions. And keep the feedback they need to assess and use the product. faces or the ability to access SharePoint coming—we’re always interested in what One thing the team here understands is functionality in the Visual Studio IDE. And you think about our products. In the the pressure developers face to deliver quick with Windows Azure Tools, you can quickly meantime, sit back, relax and get ready for results with limited resources while staying and easily develop, debug, test and deploy the launch of Visual Studio 2010 and the up-to-date on the latest technologies. It can Web applications within the familiar .NET Framework 4. VSM be tricky to build features and applications Visual Studio environment. On the user on a tight deadline. Luckily, Visual Studio experience side, Silverlight 4 creates a Dave Mendlen is the senior director of Developer 2010 and the Microsoft .NET Framework 4 whole new way for developers to build Marketing at Microsoft. He has previously served can help by empowering you to solve Windows and Web applications that run as the speech writer for Bill Gates and Steve development problems quickly and effectively, inside and outside the browser. Ballmer, as well as the director of Web Services while still allowing you to dream big. Whether you need to manage a project, strategy in the Developer Platform and Evangelism Our engineering team has worked hard maintain source code or find bugs, Visual Division. Mendlen started at Microsoft as the lead to create a development experience that Studio 2010 includes powerful tools to get product planner on .NET and Visual Studio .NET, incorporates new technologies with the lan- the job done. The new IntelliTrace feature— driving a team to bring Web services and .NET to guages and environments you already know or the “time machine for testers,” as we like millions of developers.

Throughout the development phase we’ve taken customer feedback very seriously, and we’re excited to deliver a high-quality product on launch day.

12 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Untitled-3 1 2/24/10 11:19 AM 4 VISUAL STUDIOMAGAZINE 14 VSM COVER STORY pi 00·VisualStudioMagazine.com · April2010 ·

ILLUSTRATION BY RYAN ETTER The Making of Visual Studio

With the ambitious nature of the Visual Studio 2010 upgrade, it’s hardly surprising Microsoft faced challenges on its way to RTM. We take a look behind the development of Microsoft’s game-changing IDE. BY MICHAEL DESMOND

Ask Dave Mendlen which day was toughest in the years-long development effort behind Visual Studio 2010, and the senior director of developer marketing at Microsoft is blunt: “The day we decided to add an RC [release candidate] and push our schedule out was the darkest day in our launch.”

It’s hard to argue that point. Visual Studio 2010 had, Back to the Beginning despite some of the usual pre-release misgivings about per- Microsoft’s answer, of course, was to delay the launch and formance and functionality, requited itself well throughout insert into the development schedule a public RC, which the extensive beta testing process. Visual Studio 2010 beta 1, ended up shipping on Feb. 8. released in May 2009, offered a robust trial version of the Visual Studio 2010 is now slated to ship on April 12, and by integrated development environment (IDE). And beta 2, most accounts, the critical performance and stability issues released at the Microsoft Professional Developers Conference are well behind it. (PDC) in November, boasted vast gains in both performance Still, given the ambitious nature of the Visual Studio 2010 and stability. Everything was on track for the Visual Studio upgrade, it’s hardly surprising that Microsoft faced challenges March 22 launch, also announced at PDC. on its way to release to manufacturing (RTM). From newly “We were ready to declare victory,” recalls Mendlen. “We supported platforms like Windows Azure, SharePoint and shipped beta 2 and were feeling good about our product and Silverlight, to the integration of advanced Windows the functionality. We were feeling great. And then we started Presentation Foundation (WPF) and Managed Extensibility getting the feedback around performance.” Framework (MEF) technologies, Microsoft undertook a The news was not good. Beta testers were reporting multifront development effort that taxed the resources of the significant issues with performance and stability across a Visual Studio team. number of hard-to-predict scenarios. Rob Sanfilippo, analyst at Directions on Microsoft, lauds “That was a dark day,” Mendlen continues. “That day had a Redmond for its ambitious platform support effort. “I think massive impact on everybody. We were doing a global this is a worthwhile risk for Microsoft to take, rather than launch. Imagine having the 30 launch events, and the five leaving out technologies for this major Visual Studio release. major launch events, and how do we fix that problem?” There will be some growing pains, but Visual Studio

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 15 FEATURE Visual Studio 2010

“MEF and WPF clearly are the two technologies that Microsoft is betting on for extensibility and presentation, so it made sense for Visual Studio to take bets on these technologies.” Dave Mendlen, Senior Director of Developer Marketing, Microsoft

2010 will enable developers to create some great new, high-quality “As we started integrating features together, we had to reconcile applications,” Sanfilippo says. these differences, and were able to adopt best practices from each The effort started several years earlier, well before the November team’s implementation approach,” recalls Dias, noting that the 2007 RTM of Visual Studio 2008, which was code-named “Orcas.” simplest designs and conventions were most successful. Visual Studio 2008 added support for the Microsoft .NET Framework The early work on MEF has paid off in enabling the Visual Studio 3.5 and tooling for WPF, Windows Communication Foundation team to extend functionality to new platforms, says Tony Goodhew, (WCF) and Windows Workflow Foundation (WF), as well as AJAX product manager at Microsoft. “Going forward, technologies like development. But Visual Studio 2010 aimed to make key changes MEF can really help us support more platforms easier, because to the core IDE, including the designer and code editor, as well as we can define platform-agnostic abstractions and build specific introduce a customizable interface for rich tool integration and implementations for each platform,” Goodhew explains. purpose-built developer experiences. Visually, Visual Studio 2010 shows significant gains over its “What was unique for Visual Studio 2010 was a renewed focus in predecessor. Dias says the Visual Studio team made a concerted the Visual Studio platform itself,” says Chris Dias, group program effort to improve the visual fit and finish of the IDE, from effective manager for Visual Studio at Microsoft. He explains that, after use of contrast to emphasize the code editor window to softened Visual Studio 2008, the IDE was big and getting bigger, and some- edges on windows and toolbars. The goal: To help developers focus thing had to be done to ensure the “long-term health and well being” more on core tasks. of the franchise. The effort to implement WPF 4 in Visual Studio was aided by the “Visual Studio is a very large native COM and managed applica- fact that the Visual Studio and WPF teams are neighbors, says Dias. tion. It has been in existence for more than a decade and has been “We’re lucky that both the Visual Studio team and the WPF team are developed by hundreds of different developers over the years,” Dias part of the Developer Division, because our business objectives and says. “Our ability to innovate on top of Visual Studio was being product schedules are closely aligned,” Dias explains. “We realized hampered by the complexity of the underlying code base.” early on in the 2010 product cycle that we had mutually beneficial goals. The WPF team wanted an enterprise-class application to show- Look and Feel case their framework and Visual Studio wanted a technology that Much of the work on the underlying code base occurred in the areas could support a new, separated presentation architecture.” of extensibility and presentation. Visual Studio 2010 incorporates Continues Dias: “The WPF team even moved into offices adjacent WPF 4, the latest version of Microsoft’s advanced, XAML-based to Building 41 so that we could work closer together.” graphics framework, to enable a much more dynamic and precise A team of seven developers and five testers worked full time on visual development environment. The IDE also adds support for WPF integration, collaborating with Visual Studio feature teams to MEF, a technology that enables software to discover and interface validate the new design and verify component behavior in the with software components. For Visual Studio, the incorporation of environment. To mitigate risk, the group took a staged approach, MEF enables opportunities to customize the IDE to mission-specific first inserting a model/view separation before working to build roles and seamlessly integrate extended functionality. view models specific to the new WPF skin. WPF code paths were “MEF and WPF clearly are the two technologies that Microsoft is turned off by default in the early daily builds, with only the WPF betting on for extensibility and presentation, so it made sense for shell team working with the new presentation layer. Visual Studio to take bets on these technologies,” says Mendlen, Once the WPF shell was ready, it was enabled for the entire team. who adds: “Our bet could only drive up the capabilities and quality “At this point we had two fully functional window managers and of these technologies.” command-bar systems in the product, and we could switch between MEF itself actually got its start several years ago as part of an them to identify behavior differences and regressions,” Dias says. incubation project that included the new Visual Studio 2010 Editor. Once this work was validated, the old code was simply removed. Originally called the Asset System, Dias says the technology was “The ‘point of no return’ decision was made around December later taken up to serve as the general extensibility system for .NET. 2008,” says Dias. “By that time, I’d say we had a very clear idea of what “While Visual Studio has long offered a robust extension architec- it would take to finish. We had cost projections from all teams, we ture, it was optimized for building large and deeply integrated toolsets had identified the high-risk components, and we had acknowledged that complement existing Visual Studio functionality,” Dias says. our available safety valves, just in case.” “With MEF in mind, we’ve been able to focus on scenarios that allow a Visual Studio wasn’t the first Microsoft product to add a WPF developer to replace or enhance existing functionality at a micro level.” layer over a native, Win32-based application. The Expression Suite, The Visual Studio team faced challenges as it created MEF exten- based on WPF 3.5, earned that honor. And that gave Dias and his sion points in the IDE. Dias says the lack of diagnostic tools turned crew a leg up on WPF integration. “If we found a bug or a critical early MEF implementations into a “trial and error” process. He says feature missing in WPF 3.5, we could work with the WPF team to teams often defined their own logic for populating catalogs, building add it to 4.0.” and tearing down composition containers and establishing binding Still, issues cropped up. Visual Studio, Dias says, makes heavy conventions. It fell to the Visual Studio group to untangle the knot. use of Handle to a Window (HWND) interoperability, with WPF

16 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com FEATURE

“We’re lucky that both the Visual Studio team and the WPF team are part of the Developer Division, because our business objectives and product schedules are closely aligned.” Chris Dias, Group Program Manager for Visual Studio, Microsoft

chrome often hosting a Win32 window. Says Dias: “At the minimum, created direct links to WPF dependencies. Rather than rewrite the as long as we can get an HWND, we can host the design surface or designer or cross-compile it for Silverlight, the Visual Studio team tool window. With a mixture of WPF and HWNDs in the same UI, created a platform-neutral abstraction layer with implementations some tricky problems surface.” for WPF and Silverlight. Dias singles out the “airspace” issue, where an HWND clips a On the rendering side, developers had to find a way to deal with WPF surface, as well as issues around the handling of focus and the fact that Silverlight uses a subset of the .NET Framework. “Our activation and how it flows between WPF and HWNDs. The designer runs against the larger desktop .NET runtime, and while challenge was particularly thorny in the way focus is restored when we could talk to the smaller runtime inside a Silverlight instance, moving between window content and administrative UI elements like menus and toolbars. New features were baked into WPF 4 to address these issues. SKU Driver Platform Plays A Q&A with Dave Mendlen, senior director of Developer As it turned out, the heavy lifting on WPF 4 and MEF paid big Tools Marketing at Microsoft. dividends as Microsoft worked toward another goal of Visual Studio Talk about the history of Visual Studio SKUs, and how we 2010: extending the reach of the IDE to new platforms, including ended up with nine major SKUs in Visual Studio 2008. Windows Azure, SharePoint Server and Silverlight 4. Microsoft Product Manager Goodhew says the closely matched, We entered the application lifecycle management business with XAML-based architectures of WPF 4 and Silverlight 4 enabled the Visual Studio 2005. With that release, we believed that we Visual Studio team to quickly integrate new Silverlight 4 tooling were going to enter a business that served many different and functionality. types of customers, from architects to testers. Of course, Silverlight 4 support isn’t present in the April 12 drop Our thought at the time was that we should build a product of Visual Studio 2010. The beta tooling found in Visual Studio 2010 for each different role. Over time it became clear to us that beta 2 was excised when the rest of the IDE was packaged in RC customers function in many different roles. It’s not uncommon form. Goodhew says developers will be able to add the Silverlight 4 for a developer to architect a solution in the morning, code in tooling when Silverlight 4 ships, which could be in the first half the afternoon and test in the evening. of 2010. How did the decision to cut down get made? That decision reflects the reality of complex software development. As I was explaining to a new leader in Microsoft how our “Sometimes—as in this case—things just don’t align, and rather business works, it suddenly occurred to me that we had made than doing a rushed release, it’s better for everyone to focus on the the business of buying Visual Studio way too hard. So I decided end game,” Goodhew says. to propose another path. I spent a week by myself in my office In the meantime, the Visual Studio group worked to update the working through what I believed to be the principles that we Silverlight Designer in Visual Studio 2010 to better support data- should hold ourselves to in devising a new product plan. centric application development—an area where Silverlight tooling By the way, this whole idea was crazy. We had already shipped has fallen short. Goodhew singles out the new data-binding builder Visual Studio 2010 beta 1. I had just returned from a customer and improved IntelliSense, which reduce the need for hand-coding event where we announced our product lineup, so the whole idea in data-centric Silverlight apps. Next up is a drag-and-drop binding of changing was basically nuts. But the one thing I had going for interface in the Data Sources Windows, making it easier to build me was the feedback from customers. I had heard from enough data scaffolding for service-driven Silverlight apps. customers and from enough partners that we were too complicated, “Data-centric Silverlight applications typically rest on a services and I was like a dog with a bone—I wasn’t going to give up. layer,” Goodhew says. “The multitargeting feature of Visual Studio 2010 makes it easier to migrate the service layer of your Silverlight Did the state of the economy play any role in the SKU/ application to .NET 4 on your own schedule, but still work with the pricing scheme? latest Silverlight release for your UI layer.” We talked about the economy a lot when we built out the plan. The Silverlight effort came with a host of challenges. Project We needed to think through price points that were reasonable, system integration, designer features and rendering of Silverlight and we wanted to make sure we were cheaper than the surfaces all vexed the Visual Studio development team. The competition. In the end, we basically kept prices flat. hybrid, Web/client nature of Silverlight projects also created a bit of cognitive dissonance, says Goodhew. “The Web team had to What has been customer response to the SKUs? teach the Web project system how to host and manipulate a client We got so much positive feedback on the simplification of project, how to create XAP files, deploy them to the server, etc.” the SKU lineup. There were a few customers who were Bigger challenges cropped up in the WPF-based designer, which confused, but overall the feedback has been even better than in Visual Studio 2008 treated Silverlight elements like WPF and we expected. —M.D.

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 17 FEATURE Visual Studio 2010

“There will be some growing pains, but Visual Studio 2010 will enable developers to create some great new, high-quality applications.” Rob Sanfi lippo, Analyst, Directions on Microsoft

the communication was extremely slow and hard to program against,” same time handling SharePoint-specific wire-up and deployment Goodhew explains. details behind the scenes. Their solution? Work with the Blend and Silverlight teams to Among the key challenges was the effort to get the 32-bit Visual make it possible to host Silverlight on the full desktop version of Studio development environment to work against the 64-bit the .NET runtime. SharePoint platform, says Schmelzer. “We implemented an out-of- “We also had to invent an efficient way to compose Silverlight process Visual Studio host that handled the calls between Visual content with WPF content, because while the actual rendered view Studio and SharePoint,” he explains. of the designer is Silverlight, the rest of the designer—and Visual Schmelzer credits a strong collaborative effort between the Visual Studio itself—is built on WPF,” says Goodhew. He credits the Blend Studio and SharePoint teams, which formed a series of cross- team for creating an abstraction layer that lets a single code base departmental virtual teams focusing on specific components of the work with both WPF and Silverlight frameworks. It was an effort dev effort. “It was a great partnership from the beginning,” he says. that took months. Goodhew agrees. “Extending Visual Studio to support new targets requires participation from many teams within Visual Studio, and SharePoint Adventures it always reaches into more nooks and crannies than you first realize,” A different set of challenges awaited the Visual Studio team as it he says. “It also requires participation from the folks working on worked to extend support to SharePoint. As was the case with the target platform.” Silverlight, the team benefited from work on earlier tooling—in this case, the Visual Studio 2008 extensions for Windows SharePoint The End of the Beginning Services. The extensions were incomplete and lacked full integration Mark Driver, research vice president at Gartner Inc., calls Visual with the Visual Studio IDE, but they produced a stream of feed- Studio 2010 “probably the biggest change since .NET first came out.” back that helped guide development of the integrated tooling in But he says the upcoming version of the IDE is only the beginning. Visual Studio 2010. “I think a lot more is on the table. I think this is by no means an Jay Schmelzer, principal group program manager for Visual Studio exhaustive delivery—it’s the tip of the iceberg,” Driver says. “Don’t Business Applications at Microsoft, says developers wanted a get comfortable.” streamlined F5 build/deploy/debug experience, more flexible According to Microsoft’s Dias, work on the rest of the iceberg is solutions packaging, and a flexible project system within Visual already underway. “We have a lot of block-and-tackle work we can Studio, including the ability to create a single project that contains do here to enable better experiences that target specific tasks,” he multiple types of SharePoint customizations within it. says. “For example, I’d love to be able to open an instance of the Schmelzer describes SharePoint as “an ASP.NET application shell on a second monitor and set it up as my debug experience.” that doesn’t look like a traditional ASP.NET application.” The He looks forward to Deep Zoom and overlays enabling developers challenge for his team was to create a Visual Studio experience to zoom out of a Solution to see the structure of the application and that would be consistent with ASP.NET development, while at the then overlay data about performance and unit test coverage. He also expects more work on immersive data visualization, especially in debugging scenarios. Visual Studio 2010 Timeline For the moment, work on Visual Studio 2012 or 2015 or whatever it may end up being called can take a backseat to the actual final Sept. 29, 2008: First public disclosure of Visual Studio 2010 delivery of Visual Studio 2010 on April 12. As Mendlen notes, the and the Microsoft .NET Framework 4 Visual Studio development team engaged in a sustained, years-long effort to deliver one of the largest upgrades ever to its flagship IDE, Oct. 28, 2008: Public community technology preview released only to run a last-minute sprint as it worked to iron out late perfor- at 2008 Microsoft Professional Developers Conference mance and stability issues in the beta code. May 20, 2009: Beta 1 released “I’ll tell you that we all held our breath probably from that day in Oct. 2, 2009: Team Foundation Server Basics announced early December to probably about two days after the RC drop,” recalls Mendlen, who says he’s going “someplace tropical” for vaca- Oct. 19, 2009: Beta 2 released; packaging and March 22, 2010, tion after the launch. “We got our first wave of RC feedback and we launch date of Visual Studio 2010 announced said, ‘OK, that doesn’t tell us much.’ When we were two or three Dec. 17, 2009: Schedule slip announcement made days into the twitter feeds, post-drop, we said, ‘Ah, we did it. We’re Jan. 13, 2010: New release date announced going to be OK.’” VSM Feb. 8, 2010: Visual Studio 2010 RC released Michael Desmond ([email protected]) is editor in chief of VSM. Feb. 14, 2010: RC patch for IntelliSense flaw released March 4, 2010: Visual Studio 2010 Team Explorer beta, GO ONLINE code-named “Eaglestone,” announced Go to VisualStudioMagazine.com/Desmond0410 for extended April 12, 2010: Final release date —M.D. coverage and additional interviews.

18 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Bring your XML development projects to light with the complete set of tools from Altova®

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

The Altova MissionKit includes multiple intelligent XML tools:

XMLSpy® – industry-leading XML editor • Support for all XML-based technologies • Graphical editing views, powerful debuggers, code generation, & more MapForce® – graphical data mapping tool • Drag-and-drop data conversion with code generation • Support for XML, DBs, EDI, Excel® 2007+, XBRL, text, Web services StyStyleVision® – visual stylesheet & e-Forms designer New in • Drag-and-drop stylesheet and electronic forms Version 2010: design for XML, XBRL & databases • 64-bit version • Output to HTML, PDF, RTF, Word 2007+, • Support for WSDL 2.0 & e-forms • Enhanced XBRL support Plus up to five additional tools… • JSON editing® and server conversion support • SharePoint • True electronic forms design through absolute positioning • And much more...

Download a 30 day free trial!

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

Untitled-3 1 2/23/10 2:00 PM Using Visual Studio 2010 to Build Cloud Services and Applications Visual Studio 2010 provides familiar tooling and resources for developers who want to put their applications up in the cloud. Here’s how to do it. BY JIM NAKASHIMA, HANI ATASSI, DANNY THORPE AND ANSON HORTON

Imagine building an application that could have Getting Out the Door essentially infinite storage and unlimited processing power. Now, If you have Visual Studio 2010 installed, then we’re ready to get add in the ability to dynamically scale that application depending on started. If you don’t, go install it now—we’ll wait. The Cloud Tools how many resources you want to consume—or how much you’re team has made every effort to make the experience of building a willing and able to spend. Add a dash of maintainability that gives cloud application as similar as possible to building an ASP.NET you this power without the need to manage racks of machines. application. There are some differences of course, but if you’re Finally, imagine we sweeten the pot by removing the need for you to already an ASP.NET guru, your skills will translate remarkably well. deal with installing Service Packs or updates, and you’ve got a pretty The first thing we’re going to do is get Visual Studio set up to interesting recipe coming together. We call this dish Windows build these types of applications. Simply click on File | New Project, Azure, and with Microsoft Visual Studio 2010 you’re the chef. select the Visual C# or Visual Basic top-level nodes, and find the This article is a no-nonsense walkthrough of how to use your Cloud node that appears in the Installed templates pane on the existing ASP.NET skills to build cloud services and applications. right. Once this node is selected you’ll see only a single project It’s possible to build Windows Azure applications with Visual template that says “Enable Windows Azure Tools.” Go ahead and Studio 2008 or Visual Studio 2010, but Visual Studio 2010 gets you double-click on that template; the name and location that you out of the gate faster and generally has a more deeply integrated choose don’t matter in this case. You’ll end up with an HTML experience; hence, it’s the focus of this article. If you’re interested document opened in a tab, which provides instructions on down- in using Visual Studio 2008, much of the content is applicable, but loading Windows Azure Tools. Follow the directions; this is you’ll need to download Windows Azure Tools for Microsoft something that you’ll only have to do the first time that you create a

Visual Studio. Cloud Service with Visual Studio. ETTER RYAN BY ILLUSTRATION

20 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com FEATURE

Windows Azure Tools have a couple of additional installation of how they run in the cloud. To set these properties, simply requirements outside of what Visual Studio 2010 requires by default. double- click on the role itself and you’ll be presented with a user In particular, you’ll need to enable IIS on your development machine. interface reminiscent of the Project Designer. The page that has instructions for installation lists the process for doing this. We hope to eventually remove this requirement. Data in the Cloud We now have a very simple Cloud Service. We could debug the Creating Your First Cloud Service application at this point by hitting F5, though all you would see is a After the tools have been installed, the “Enable Windows Azure blank Internet Explorer window. As you’re coding, it’s important to Tools” project template will be replaced by a project template consider the Windows Azure model for making your application named “Cloud Service.” In order to create your first Cloud Service scalable. In order to handle additional traffic to your application, project, double-click on this project template (off of the File | New you increase the number of instances for each role. That means Project… | Visual C# | Cloud node) and you’ll be taken to a new requests will be load-balanced across your roles, and that will affect dialog. This dialog allows you to configure the roles associated how you design and implement your application. with your Cloud Service. Roles are a new concept introduced with In particular, this dictates how you access and store your data. Windows Azure. The easiest way to think about them is that they’re Many known data storage and retrieval methods aren’t scalable, and the individual, scalable units of code. You can create any number of therefore aren’t cloud-friendly. For example, storing data on the local instances of roles, and then load balance work among them. file system shouldn’t be used in the cloud because it doesn’t scale. There are two types of roles: Worker roles and Web roles. A Web role To achieve the scaling nature of the cloud, you need to be aware of is simply a Web application running on IIS. It’s able to communicate to the new storage services. Windows Azure Storage provides scalable the outside world through an HTTP or HTTPS endpoint. In general, a blob, queue and table storage services, and Microsoft SQL Azure Web role will respond to requests, perform actions and then wait for provides a cloud-based relational database service built on Microsoft the request. A Worker role is a background- processing application that SQL Server technologies. Blobs are used for storage of named files runs arbitrary Microsoft .NET Framework code. These are usually along with metadata. The queue service provides reliable storage and used for work that should be scheduled, long running tasks and so on. delivery of messages. The table service gives you structured storage, The dialog that appears will show a list of templates—split between where a table is a set of entities that each contains a set of properties. Web and Worker roles—on the right. These templates can be double- To help use these services there’s a local emulation environment clicked in order to add them to the right pane. A Cloud Service can called the Development Storage that simulates the way these storage consist of any number of Worker roles and any number of Web roles. services run in the cloud. You can write your application to target In this case, we’ll double-click on a Visual C# ASP.NET Web Role. the Development Storage services using the same APIs that target Once the Web role appears in the right pane (see Figure 1), you may the cloud storage services. rename the role by either clicking on the pencil icon that appears Discussing the correct way to use the various storage services that when the role is hovered over, or by selecting the role and pressing F2. Windows Azure offers would take too long to explain in this article; Let’s rename the role to “MyASPNETRole” and then click OK. however, there are numerous samples available at http://tiny url.com/ At this point Visual Studio will go through the process of creating yfkxb86, and these offer good examples of building applications a solution that contains two projects. The first project is a Cloud using these APIs. In addition, the usual support for learning APIs Service project. This project contains all of the configuration infor- is built into the tools. You can use Object Browser to view the new mation needed in order to run your service in the cloud. The second assemblies—IntelliSense will show all of the types and APIs, project is really just a slightly modified ASP.NET application. In including their XML documentation—and F1 will navigate you addition to the normal ASP.NET goodness, the project contains from a type to the online version of its help. certain Windows Azure-specific references: ■ Microsoft.WindowsAzure.Diagnostics (diagnostics and Debugging logging APIs) To demonstrate running and debugging on Windows Azure locally, ■ Microsoft.WindowsAzure.ServiceRuntime (environment and let’s use one of the samples from the MSDN Code Gallery page runtime APIs) mentioned previously. ■ Microsoft.WindowsAzure.StorageClient (.NET API to access the Windows Azure storage services for blobs, tables and queues) The file WebRole.cs contains code to set up logging and diagnostics as well as a trace listener in the web.config/app.config that enables using the standard .NET logging API on Windows Azure. The cloud service project acts as a deployment project. It provides Windows Azure-specific run, debug and publish functionality. You may notice it’s marked as the startup project for the solution (it’s bold). It’s important to keep it this way; this makes it so that when you hit F5, your application is run in a local simulation environment for the cloud known as the Development Fabric. After you’ve created the composition of the solution, it’s pretty straightforward to make changes. If you want to add another role, just right-click on the Roles node in solution explorer and select the appropriate command. Each of the roles listed under the Roles node also contain properties that can be set to control the behavior Figure 1. Adding roles to a new Cloud Service project.

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 21 FEATURE Windows Azure Development

if (msg != null) { string path = msg.AsString

To debug the application, go to the Debug menu and select Start Debugging. Visual Studio will build your project, start the Development Fabric, initialize the Development Storage (if run for the first time), package the deployment, attach to all role instances and then launch the browser pointing to the Web role. At this point you’ll notice that the browser launched pointing to your Web role and the Development Fabric is started in the notifi- cations area of the taskbar. The Development Fabric is a simulation environment that simulates running role instances on your machine similar to how they run in the real cloud. Right-click on the Windows Azure notification icon in the taskbar and click on Show Development Fabric UI. This will launch the Development Fabric application that allows you to perform various Figure 2. The Development Fabric. operations on your deployments, such as viewing the logs as well as restarting and deleting deployments (see Figure 2). You should also Go to the samples page and download the samples for Visual notice that the Development Fabric contains a new deployment that Studio 2010. Then, extract all the files to an accessible location hosts one Web role instance and one Worker role instance. such as your Documents folder. By looking at the processes that Visual Studio attached to Run Visual Studio 2010 as an administrator and then open the (Debug/Windows/Processes), notice that there are three processes: thumbnails solution of your extracted samples. The thumbnails WaWebHost.exe, WaWorkerHost.exe and iexplore.exe. sample is a service that demonstrates the use of a Web role and a WaWebHost (Windows Azure Web instance Host) and WaWorker- Worker role along with the blob and queue services. Host (Windows Azure Worker instance Host) host your Web role The Web role provides a front-end application for the user to and Worker role instances, respectively. In the cloud, each instance is upload photos. It then adds a work item to a queue. The Worker hosted in its own virtual machine, whereas on the local development role fetches the work item from the queue and creates thumbnails simulation each role instance is hosted in a separate process and in the designated directory. Visual Studio will attach to all of them. Once you open the solution, you’ll notice there are three proj- By default, Visual Studio uses the script engine to attach to IE. ects. Thumbnails is the cloud service that associates two roles, To debug Microsoft Silverlight applications, you need to enable the Thumbnails_Web Role and Thumbnails_WorkerRole. Thumbnails_ Silverlight debugger from the Web role project Properties. WebRole is the Web role project that provides a front-end Browse to an image you’d like to upload and click Submit. Visual application to the user to upload photos and adds a work item to Studio will break at the breakpoint you set inside the submit Button_ the queue. Thumbnails_WorkerRole is the Worker role project Click method, giving you all of the debugging features that you’d that fetches the work item from the queue and creates thumb- expect from Visual Studio. Hit F5 to continue. The submitButton_ nails in the designated directory. Click method generates a unique name for the file, uploads the This sample demonstrates the use of the StorageClient library to image stream to blob storage and adds a message on the queue that interact with both the queue and blob services. contains the file name. Now Visual Studio will break at the break- Add a breakpoint to the submitButton_Click method in the point set in the Worker role, which means that the Worker received a Default.aspx.cs file. This breakpoint will get hit when the user message from the queue and it’s ready to process the image. selects an image and clicks on Submit on the page:

protected void submitButton_Click( object sender, EventArgs e) { if (upload.HasFile) { var name = string.Format("{0:10}", DateTime.Now. Ticks, Guid.NewGuid()); GetPhotoGalleryContainer().GetBlockBlob(name). UploadFromStream(upload.FileContent);

Second, add a breakpoint in the Run method of the worker file, WorkerRole.cs, right after the code retrieves a message from the queue and checks if one exists. This breakpoint will get hit when the Web role puts a message in the queue that is retrieved by the worker:

while (true) { try { CloudQueueMessage msg = queue.GetMessage(); Figure 3. Configuring a storage domain.

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

Hit F5 to continue. The Worker will get the file name from the mes- sage queue, retrieve the image stream from the blob service, create a thumbnail image and upload the new thumbnail image to the blob service’s thumbnails directory, which will be shown by the Web role.

Deployment Now that you’ve created, edited and debugged your application locally, you’re ready to deploy it to the cloud. The following is a good process for deploying an application to Windows Azure: ■ Get your application running locally in the Windows Azure Development Fabric using local storage. ■ Run your application locally in the Development Fabric using a Windows Azure Storage Account. ■ Run your application on Windows Azure using a Windows Figure 4. Storage Connection String dialog. Azure Storage Account. In the first stage, you can do all your development on your local machine using the Development Fabric and Development Storage It’s a good idea to create an affinity group to ensure that your storage as surrogates for the Windows Azure cloud infrastructure. You and hosted services that use it are located in the same data center don’t even need a network connection—you can develop and debug whenever possible. Affinity groups can also specify a preference for your Windows Azure application or service completely offline. a geographical region so that service and storage are as close to In the second stage, you replace the local storage surrogate with your target audience as possible to minimize network transit time. the real deal, Windows Azure Storage, but retain the debugging Click on Create and you’ll see a summary page for your new and diagnostic advantages of executing your Windows Azure storage account. Now you need to tell your Thumbnails service to application code in the local Development Fabric. You can set use your new storage account to store its thumbnails and images. breakpoints in source code, step through source code line-by-line, Double click on the Thumbnails_WebRole node under Roles in evaluate expressions and examine call stacks while your Windows the Visual Studio Solution Explorer to open its properties page. Azure app interacts with cloud storage. You’ll probably spend 20 Select the Settings tab, select DataConnectionString and click on percent to 25 percent of your project cycle in this stage, refining the Edit button on the far right of the grid row. This brings up the your code and testing against real-world asynchronous operations. Storage Connection String dialog, shown in Figure 4. In the third stage, your main focus is testing and performance “Use development storage” is the default for new Windows Azure tuning. With your Windows Azure application executing in the projects. Click on “Enter storage credentials” and then enter your Windows Azure cloud, you won’t have the luxury of source code storage service details. debugging, so you’ll have to fall back to diagnostic logging. In the AccountName field, enter the service/domain name you You probably don’t want your app to be seen by the whole world on entered when creating your storage service. This is the first part of your target URL the instant you upload it to the Windows Azure cloud. your domain (thumbnails1138, all lower case, in the example). The Windows Azure Hosted Service has the option of multiple In the AccountSharedKey field, enter the Primary Access Key deployments within the same hosted service. Each Windows Azure displayed on your storage service summary Web page. You can hosted service has a private staging deployment area where you can select the key text in the browser, copy it and paste it into the quietly test your code in the cloud, and a public production deploy- AccountSharedKey edit box. ment area where you release tested code for your customers to use. Note that the Secondary Access Key provides the same access to Staging deployments can only be accessed via a unique URL your storage account as the Primary Access Key and is generated as that’s prefixed by a globally unique identifier (GUID) assigned by a backup should your Primary Access Key be compromised. the system. Production deployments can be the target of custom domain name mappings for easy access.

Moving to Windows Azure Storage Now that the Thumbnails service is running on a local machine in the Developer Fabric, let’s upgrade it to work against a Windows Azure Storage account in the cloud. This involves getting a storage account and making the configuration changes to run the Thumb- nails service against your storage account. Executing locally but using cloud storage for data is a great way to ensure that your code will run when hosted on Windows Azure. Start by navigating to the Windows Azure Developer Portal (windows.azure.com) and sign in with your Windows Live ID. From the page, select New Service and click on Storage Account. In the Create a Service page, fill in a friendly name for the storage account. Then fill in the service/domain name on the next page (see Figure 3, opposite page). This domain name is global so you may need to fiddle with it a bit to get a name that’s not already in use by another service. Figure 5. Configuring a hosted service.

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 23 FEATURE Windows Azure Development

Regenerating a key invalidates the old key, shutting down storage To test your Cloud Service in the Staging access to anyone still using the old key. area, you need to run it. Click on Run. Leave the connection endpoints set to use the default HTTPS This will put your Web role in the Initial- endpoints and click on OK. izing state. When the Web role is ready, Repeat these steps for the Thumbnails_WorkerRole under Roles the state will change to Started. Once as well, so that the Web role will be talking to the same storage your roles have been started you can test service as the Worker role. by navigating to the staging URL, which Figure 6. Once you have switched the Web and Worker roles to use is the cloudapp.net URL that begins with The promotion button. Windows Azure Storage, press F5 in Visual Studio to debug your a GUID. cloud service and ensure that everything works correctly. Provisioning an application in the data center involves a lot of You’ll see that the Web page URL you’re debugging is still locally heavy lifting behind the scenes. Allow at least 10 minutes for your hosted, but the URLs of the thumbnails (visible in their Properties app to transition from Initializing to Started. After you’re happy dialogs) now point to Windows Azure Storage. with your cloud service on staging, you can promote it to produc- Note that this stage of development—local services with cloud tion by clicking on the button shown in Figure 6. storage—will most likely have the worst performance of the three When the details of your deployment show up on the Produc- stages of deployment. Stage one (local/local) will be pretty snappy tion side of the page, your service will be up and running at its because everything is in the same box and has a total audience of final URL. one. Stage three (cloud/cloud) will have the benefit of cloud-scale Note that multiple deployments will default to using the same hardware and data center affinity. Stage two (local/cloud), however, storage service; if you need data isolation between production and will be executing code that reasonably assumes its storage is nearby— staging (for example, so staging can wipe its database without but in fact the data is probably many network hops away from the affecting production data), you’ll need to modify your storage local execution environment. bindings for each deployment before you deploy them. This is typi- Don’t evaluate the performance of your application in stage two. cally done by using two sets of storage and migrating production You can turn that network lag into your advantage, though: use this data to staging before promoting staging to production. stage as a stress test to see how your code handles exaggerated response times from its storage service. If you’ve done something Familiar Tools with a synchronous call that should really be asynchronous, you’ll Visual Studio 2010 makes it easy to create, edit, configure, debug probably notice it pretty quickly. and deploy applications that run on Windows Azure. In particular, Once you have everything working in the local/cloud configuration, it’s possible to make use of the better part of your existing skill set you’re ready to deploy your code to a Windows Azure hosted service. with both Visual Studio and ASP.NET. Windows Azure presents huge efficiency, stability and cost-saving opportunities, and Visual Creating a Hosted Service Studio 2010 is a fast way to get an application up and running on To create the fully hosted service, go back to the Windows Azure the platform. Developer Portal and sign in with your Live ID. Click on New For the latest news and information about Windows Azure, make Service, and then click on Hosted Services. sure to visit windowsazure.com and blogs.msdn.com/jnak. VSM This will take you to a page where you can specify the project- friendly name and description used by the developer portal. Enter Anson Horton has been a program manager at Microsoft since 2001. He a service label. Click on Next. Now you can enter a domain name for currently works on the Cloud Tools team within Visual Studio. Prior to that your hosted service project (see Figure 5, p. 23). Set the affinity group he worked on the C# team from the time its inception, and was on the C++ to match the Thumbnails affinity group created earlier with the team before that. He has been involved in the design of the Windows Azure storage service. After the project is created, you’ll see a summary Tools, the C# language and compiler, the C# project system, the C# IDE page for your project. (IntelliSense), and the C# Expression evaluator and debugger. Horton To deploy the project from Visual Studio, right click on the maintains a blog at blogs.msdn.com/ansonh. Thumbnails project node in Solution Explorer and select Publish. This command builds a package of your Windows Azure application Hani Atassi is a software engineer on the Windows Azure Tools team where binaries and related files, opens Windows Explorer to show the local he fulfills his passion to build software for Windows Azure developers. Prior directory where the package was built, and launches your default to his work on cloud tools, Atassi spent time developing Windows Vista and Web browser to browse to the developer portal. Microsoft.com. From the developer portal Web page, navigate to the Thumbnails Hosted Service summary page and click on Deploy from under Danny Thorpe is a principle software engineer on the Windows Azure Tools Staging to bring up the Staging Deployment page. This is where you team. In past lives he was a contributing founder of Google Gears at Google specify the package and the configuration file to upload. and Delphi Compiler Architect at Borland. You can visit Thorpe’s blog, You can copy the path from the Windows Explorer window that Architect of Destruction, at dannythorpe.com. Visual Studio opened into this File Open dialog, which will make it easy for you to select the Service Package (.cspkg) and Service Jim Nakashima is a program manager on the Windows Azure Tools team Configuration files. focusing on building great end-to-end developer experiences for Windows The portal will then upload the package and deploy your cloud Azure. He spent a number of years working on Windows Presentation service to staging. This puts your roles in the Allocated state. This Foundation and Silverlight Designer and tools before being attracted to the means your Windows Azure application has been provisioned infinite possibilities of the cloud. You can find his Cloudy in Seattle blog at with data center hardware, but it’s not scheduled to run. blogs.msdn.com/jnak.

24 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Untitled-11 1 3/11/10 10:45 AM Untitled-1 2 3/16/10 4:30 PM Untitled-1 3 3/16/10 4:31 PM The Evolution of Visual C++ in Visual Studio 2010 C++ developers will see major improvements—beyond support for Windows 7 APIs—in Visual C++ 2010. BY SUMIT KUMAR

With the release of Visual Studio 2010, several improve- C++0x Core Language Features ments have been made to make life easier for C++ developers. The Visual Studio 2010 gives developers powerful new core language fea- three areas of focus for Visual C++ 2010 include a better program- tures from the upcoming C++0x standard. The Visual C++ compiler ming model, overall performance and productivity, and support in Visual Studio 2010 has enabled six C++0x core language features: for Windows 7 applications with an updated MFC Library. lambda expressions, auto keywords, rvalue references, static_assert, Specifically, Visual Studio 2010 enables a more modern pro- nullptr and decltype. gramming model by adding core C++ language features from the Lambdas are a core language feature that have lightweight natural upcoming C++0x standard and overhauling the standard library to syntax to define function objects where they’re used, and these take advantage of the new language features. There are new parallel expressions have no performance overhead. Function objects are a programming libraries and tools to simplify the creation of very powerful way to customize the behavior of Standard Template parallel programs. Library (STL) algorithms and can encapsulate both code and data Visual Studio 2010 has made great strides in performance and (unlike plain functions). In C++ development, lambda expressions developer productivity. The new Windows Presentation Foundation implicitly define and construct unnamed function objects. (WPF)-based IDE is more extensible, has a new look and feel, and Auto keyword is now used to automatically determine the type has been designed to improve readability. Document windows such of a variable from its initializer. Auto reduces verbosity and helps as code editor and design view windows can now float outside the important code stand out; it also helps make code more generic by main IDE window and can be displayed on multiple monitors. allowing you to write templates without having to worry about the For C++ developers, IntelliSense and code-browsing features now types of intermediate expressions. scale to projects with millions of lines of code without compromising C++0x has introduced a new kind of reference type called rvalue on performance. The build system and project system have migrated references. Rvalue references help solve the problem of unnecessary to MSBuild and offer better customizability and extensibility. Finally, copying and enable perfect forwarding. This reference type enables code-generation improvements in the back-end of the Visual C++ move semantics. When the right-hand side of an assignment is an compiler enable better performance and code quality. rvalue, then the left-hand side object can steal resources from the In this article, I’ll take a closer look at these core enhancements right-hand side object rather than performing a separate allocation. to Visual Studio 2010 and explain how these language features, Perfect forwarding allows you to write a single function template

updated libraries and tools can benefit C++ developers. that takes N arbitrary arguments and forwards them transparently ETTER RYAN BY ILLUSTRATION

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

to another arbitrary function. For a more detailed discussion on (PPL), the Asynchronous Agents Library, and parallel debugging rvalue references, check out the MSDN documentation on the and profiling tools. topic at http://tinyurl.com/ybx47jj. The concepts of tasks, the PPL and the Asynchronous Agents Static_assert allows you to test assertions during compile time, Library provide you with a programming model to approach writing rather than at execution time. Static assertions enable you to trigger parallel code more elegantly. These libraries are based on the new compiler errors with custom error messages that are easy to read; ConcRT, which is included within the Visual C++ runtime. The map- they’re especially useful for validating template parameters. ping between tasks and execution threads—and ensuring that all the Nullptr keyword has been introduced in this release to help cores are optimally utilized—is managed by ConcRT, which is the developers avoid difficult-to-diagnose failures in perfect for- lowest software layer that talks to the operating system and arbitrates warding functions. Nullptr is a constant, which is convertible to between multiple concurrent components competing for resources. any pointer type, but no other type (for example, int or char). In Any computation that can be decomposed into sub-computations addition to being used in the perfect forwarding functions, this can be implemented using tasks. For example, sorting two halves of new nullptr can be used anywhere the macro NULL was used an array can be done by two different tasks concurrently. Even the as a null pointer. simple concept of threads takes you away from your problem Decltype is a language feature that allows the compiler to infer domain by making you think about the hardware, OS and critical the return type of a function based on an arbitrary expression and sections. Task is an abstraction that’s much closer to your problem makes perfect forwarding more generic. In past versions, for two domain. Tasks are first-class concepts in parallel algorithms, classes arbitrary types T1 and T2 there was no way to deduce the type of and containers included in PPL. an expression that used these two types. The decltype allows you to Additionally, the Asynchronous Agents Library gives you a state things like an expression that has template arguments, such dataflow- based programming model where computations are as: sum() has the type of T1+T2. dependent on the required data becoming available. The library is based on the concepts of agents, message blocks and message-passing Standard Library Improvements functions. An agent is a component of an application that does Substantial portions of the standard C++ library have been rewritten certain computations and communicates asynchronously with other in Visual Studio 2010 to take advantage of the new C++0x language agents to solve bigger computation problems. This communication features and increase performance. between agents is achieved via the message-passing functions In particular, adoption of rvalue references has yielded many using message blocks to help avoid issues that arise from the use of benefits. Types such as vector and list now have move constructors shared memory in concurrent applications. and move assignment operators of their own. For example, vector Support for parallel debugging and profiling in Visual Studio reallocations exploit move semantics by picking up move constructors. 2010 makes it easier to debug concurrency issues. The debugger Therefore, if your types have move constructors and move assignment includes new tool windows to visualize the state of all tasks in an operators, the library will recognize that information automatically. application. The concurrency profiler tool allows you to visualize The C++0x function template make_shared() has been added to the behavior of parallel applications. the standard library. You can now make a shared pointer to an object at the same time that you’re constructing the object: IntelliSense and Design-Time Productivity A brand new IntelliSense and browsing infrastructure is included in auto sp = make_shared(args); Visual Studio 2010. In addition to helping with scale and responsive- ness on projects with large code bases, the infrastructure improvements This provides you with a more convenient, robust and efficient have enabled building some fresh design-time productivity features. way to use a shared pointer. The standard library now provides you with a new pointer type unique_ptr that can be used in place of auto_ptr and allows you to implement strict ownership semantics without affecting safety. This release includes a number of new algorithms proposed in various C++0x papers, such as min/max element, iota and is_sorted. Additionally, a small set of conversion libraries has been included in the standard library, which will allow developers to do conver- sions such as UTF-8 to UTF-16 with ease. Also, many of the TR1 features that existed in namespace std::tr1 in the previous release, such as shared_ptr and regex, have now been made part of the standard library and have been moved under namespace std.

New Concurrency Runtime and Libraries Visual Studio 2010 introduces the Parallel Computing Platform, which helps you write high-performance parallel code quickly while avoiding subtle concurrency bugs. This lets you avoid some of the classic problems faced with concurrency. The Parallel Computing Platform has four major parts: the Figure 1. In Visual Studio 2010, live error reporting shows loss of Concurrency Runtime (ConcRT), the Parallel Patterns Library IntelliSense at the location of the error and with a tool tip message.

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 29 FEATURE Visual C++ 2010

The Visual C++ compiler in Visual Studio 2010 has enabled six C++0x core language features: lambda expressions, auto keywords, rvalue references, static_assert, nullptr and decltype.

IntelliSense features such as live error reporting and quick info Developers also get Auto Complete help for include statements in tooltips are based upon a new compiler front-end. It parses the full Visual Studio 2010. A list of relevant include files is displayed in a translation unit to provide you with rich and accurate information drop-down while typing #include, and the list will refine as you type about code semantics, even while the code files are being modified. and help you add the right include files with less typing. Call All the code-browsing features, like class view and class hierarchy, Hierarchy—an improved version of Call Browser—provides you now use the source code information stored in a SQL database that with the calls to and calls from trees for any function in the same enables indexing and has a fixed memory footprint. Unlike previous window. Inactive code now retains the semantic information by releases, the Visual Studio 2010 IDE is always responsive and you no maintaining colorization, instead of becoming gray. longer have to wait while compilation units get reparsed when Note that while all the code-browsing features are available for changing a header file. both pure C++ and C++/CLI, IntelliSense-related features like live The IntelliSense live error reporting is a new feature added in this error reporting and Quick Info will not be available for C++/CLI in release. The editor displays compiler-quality syntax and semantic the final release of Visual Studio 2010. We’re working on adding full errors during browsing and editing of code, without doing a build. A IntelliSense support for C++/CLI in the future. wavy underline (squiggle) is displayed at the location of the error, and the tool tip shows the error message, as shown in Figure 1 (p. 29). The Build and Project Systems error list window also shows this error, as well as the Intelli Sense Visual Studio 2010 also offers substantial improvements in the errors from elsewhere in the current compilation unit. build system and the project system for C++ projects. Another new feature to increase your productivity with file or The most important change is that MSBuild is now used to build symbol search is Navigate To, under the Edit menu or using the C++ projects. MSBuild is an extensible, XML-based build orches- shortcut “Ctrl+comma.” This feature gives you real-time search tration engine that has been used for C# and Visual Basic projects results (based on substrings as you type) matching your input in previous versions of Visual Studio. MSBuild is now the common strings across any project. It also works for C# and Visual Basic Microsoft build system for all languages. It can be used both in the projects, and is extensible. build lab as well as on individual developer machines. C++ build processes are now defined in terms of MSBuild target and task files and provide you a greater degree of customiz- ability, control and transparency. The C++ project type now has a new extension: .VCXPROJ. Visual Studio will automatically upgrade old .VCPROJ files and solutions to the new format. There’s also a command-line tool, vcupgrade.exe, to upgrade single projects from the command line. In the past, you only had the option of using the toolset—the compiler and libraries—that came with that particular version of Visual Studio. Visual Studio 2010 solves that problem by allowing you to target a different version of the toolset—for example, the Visual C++ 9.0 ver- sion of compiler and libraries from Visual Studio 2010—while being able to take advantage of all the new productivity features. This functionality is known as native multi target ing. You can also extend the default Figure 2. The updated MFC library allows developers to take advantage of thumbnail previews and build system by adding a tool or tabbed thumbnails in Windows 7 for a tabbed MDI MFC application. build step. This is especially

30 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com FEATURE

Substantial portions of the standard C++ library have been rewritten in Visual Studio 2010 to take advantage of the new C++0x language features and increase performance.

optimized for better performance. Breaking false dependencies, vector ization of constant vector initializations, and better alloca- tion of XMM registers to remove redundant loads, stores and moves are all improvements that have been introduced in this release. For improved performance, applications should be built using Link Time Code Generation (LTCG) and Profile Guided Opti- mization (PGO). Compilation with LTCG usually takes longer than non-LTCG compilation, especially in large applications. In Visual Studio 2010 the LTCG compilation has been improved by up to 30 percent. PGO instrumentation runs have been made faster by adding support for no-lock versions of instrumented binaries. There’s also a new POGO option, Pogo- Figure 3. The popular MFC Class Wizard—which lets developers visually add classes, messages and SafeMode, which enables you to variables to MFC projects—is back in Visual Studio 2010. specify whether to use safe mode or fast mode when you optimize use ful for creators of libraries and tools. The Project system, which an application. Fast mode is the default behavior. Safe mode is sits on top of the Build system, leverages the extensibility provided thread-safe, but slower than fast mode. to it by MSBuild. It allows you to surface your customizations in A dedicated thread to write .PDB files has been introduced in the project system UI, enabling developers to configure those cus- this release, so you’ll see link time improvements when you use tomizations in the same way that they can configure C++ compiler the /DEBUG switch. Also, the quality of compiler-generated code settings in the property pages. You can also configure a project system has been improved. There’s now full support for Advanced Vector to use your own platform, similar to the existing x86 or x64 plat- Extensions (AVX) that are very important for floating-point- forms, or your own debugger. intensive applications in AMD and Intel processors via intrinsic MSBuild provides better diagnostic information to make it easier and /arch:AVX options. Floating point computation is more precise for you to debug build problems. This also makes incremental with /fp:fast option. builds more reliable. Plus, you can create build systems that are more closely tied to source control and build lab, and are less Build Great Applications on Windows 7 dependent on the developer machine configuration. Windows 7 has introduced a number of exciting technologies and features. You can take advantage of innovations like Direct3D 11, Faster Compilation and Better Performance DirectWrite, Direct2D and Windows Web Service APIs by using In addition to the design-time experience improvements described the SDK headers and libraries available in Visual Studio 2010. so far, Visual Studio 2010 also improves the compilation speed, In addition to making all the Windows APIs available to devel- quality and performance for applications built with the Visual C++ opers, this release of Visual Studio gives you access to Windows 7 compiler. The compiler back-end has added multiple code-generation functionality through updated MFC libraries. Your existing MFC enhancements to bring these improvements. applications will light up on Windows 7 just by recompiling, and The performance of certain applications depends on the working your new applications will be able to take full advantage of the new set. The code size for the x64 architecture has been reduced in the Windows 7 features. For example, your application’s integration range of 3 percent to 10 percent by making multiple optimizations with Windows Explorer can now be better optimized by making in this release, which has resulted in a performance improvement use of file handlers for preview, thumbnails and search. Taking for such applications. advantage of previews, thumbnails and the search indexer provided Single Instruction Multiple Data code generation—which is by Windows is as easy as selecting these options in the MFC important for game, audio, video and graphics developers—has been Application Wizard. Your application will be able to show rich

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 31 FEATURE Visual C++ 2010

MFC enables applications to become multi-touch-aware and calls appropriate messages for you to handle when the various touch events occur. thumbnails and previews in Windows Explorer. MFC provides this capability without you having to write a single additional line of code. One of the most noticeable UI changes in Windows 7 is the new Taskbar. MFC allows developers to quickly take advantage of features such as jump lists, tabbed thumbnails, thumbnail preview, progress bar and icon overlay, as shown in Figure 2 (p. 30). The Ribbon UI now has a Windows 7-style ribbon as well. MFC enables applications to become multi-touch-aware and calls appro- priate messages for you to handle when the various touch events occur. Your application can register to inform MFC that it’s interested in touch and gesture events, and MFC will take care of appropriately routing those events for your application. MFC also makes applications high-DPI aware by default. Therefore, your applications will adapt to high-DPI screens and won’t look pixilated or fuzzy. MFC internally scales and changes fonts to make sure the UI continues to look sharp on high-DPI displays. In addition to some of the new Windows 7 features, Visual Studio 2010 supports features that have existed since Windows Vista but were not included in previous releases of MFC. For example, Restart Manager is a very useful feature introduced in Vista that enables an application to perform an application save before terminating, and can re-invoke the application and restore its state from before shut- down. You can now take full advantage of Restart Manager in your MFC application to handle crashes and restarts more elegantly. Another addition is the Task Dialog, which is an improved version of message box. MFC now has a wrapper for Task Dialog. Functionality has been added in MFC, and this release also makes it easier to work with the library in the IDE. One of the most commonly requested features, MFC Class Wizard, has been brought back from Visual Studio 6.0 and improved. You can easily add classes and event handlers in your application using MFC Class Wizard. Additionally, this release has introduced a rich Ribbon designer while also making the Ribbon itself an XML resource rather than code, as it was in the previous release.

Wrapping Up Visual Studio 2010 is a major release in the evolution of Visual C++. Whether it’s the improved productivity with large code bases, the introduction of C++0x language features, support for parallel coding or the opportunity to write modern Windows 7 applications, Visual Studio 2010 has a lot to offer a C++ developer. For further discussion on different features, please refer to the MSDN documentation and to the Visual C++ Team’s blog at blogs.msdn.com/vcblog, which was also used as the basis for some of the sections in this article. A more detailed version of this article will also be published in the April issue of MSDN magazine. VSM

Sumit Kumar is a program manager in the Visual C++ IDE team. He holds an Master of Science degree in Computer Science from the University of Texas at Dallas.

IN THIS SECTION: Ask Kathleen · 33 ////////////////////////////////////

{ ASK KATHLEEN }

Scaled-Down the language of the template and C# is the default. If you’re working with Visual Studio 2010, you can drop the version 3.5 portion Code Generation because the custom tool now defaults to the current version of the Improve development with small-scale generation. framework. If you’re outputting Visual Basic, you also need to add BY KATHLEEN DOLLARD an output directive to specify the extension. The in-line DSL is actually C# or Visual Basic code. Code in a

T4 template is enclosed in statement blocks delimited by <# #>: Generation .NET Code Q: My manager doesn’t want to shift our development to the kind of application code-generation approaches you’ve described, but I’m <# incredibly sick of writing the same 11 lines of code. I’d hoped that Item("MyClass"); auto properties would help, but they don’t allow notification that the Property("FirstProperty", "string"); property changed. Is there any way to avoid rewriting all this code? Property("SecondProperty", "int"); A: There are two ways to use code generation in .NET. You can use Property("ThirdProperty", application code-generation techniques with a separate modeling/ "IEnumerable"); metadata-defining step or your own architecture. I assume your Run(); manager doesn’t want to adopt those approaches. You can also use #> T4 code generation as a localized development tool. You can approach this in a few ways, including an approach I call in-line DSL. The first four lines of code build a simple object graph of the inform - This is a pseudo-DSL that’s a hack compared to a real, textual DSL, ation you’d like to output. The last line actually outputs the code. but it gets the job done. I’ll show you how to define your class in The final piece makes this work. An include directive references terms of T4 and generate properties in place. another T4 template, which contains the Item, Property and Run While I use application code generation on projects, I developed methods. I add this line right after the template directive: this approach for infrastructure classes—particularly ones requiring extra bulk to support Managed Extensibility Framework (MEF) <#@ include file="Support.t4" #> interfaces. The approach is also useful on small projects with unique architectures, and when you just can’t make a broad commitment to This references a T4 file in the same directory, although you could code generation. It’s also useful as a secondary technique within access any file. Relative references are desirable because your project development environments that rely on application code generation. structure should remain the same across different machines in your It’s a bit of a twist in thinking to define your metadata in T4, but I group, but the location of that structure varies. I use the .T4 rather think there are big wins. Defining your metadata in place allows than .TT extension because the custom tools are assigned automati- clear recording of your intent, which in this case is simply to create a cally to only the .TT file in Visual Studio 2008. In Visual Studio property. When you need this information in multiple locations, 2010, ensure there’s not a custom tool for the support templates. such as creating an interface and a corresponding implementation, Template editing helpers recognize both extensions. you can automatically reuse a single definition. And, perhaps most The Support.t4 file provides an abstraction layer that points to the important, if you need to change what a standard property looks like templates that do the actual work. If you have many in-line DSL you can do it in one location and push it out across your application. templates relative to the Support.t4 template, this gives you more To begin this approach, create a text template to hold the in-line flexibility in accessing the support templates that do the heavy lifting: DSL inside your project. In Visual Studio 2010, add a Text Template item. In Visual Studio 2008, create a text file and give it a .TT <#@ include file="..\InternalGeneration\SuppportCommon.t4" extension. This creates a template file recognized by template-editing #> tools and as well as a custom tool to create the output as a dependent <#+ file. In Visual Studio 2008 you need to add the template header: private string nspace = "KadGen.MyNamespace"; #> <#@ template debug="true" hostspecific="false" language="c#v3.5" #> The Support.t4 template can also include information such as the namespace for all of the C# files that reference it. This reduces the Items prefixed with <#@ are template directives—in this case a amount of information that must be placed in each T4 template. directive that initiates the template. The language portion defines Note that the delimiter for the namespace definition is <#+ #>. T4 is

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 33 { ASK KATHLEEN }

compiled into normal .NET code, which runs to create your output. kept the pseudo-DSL and the OutputProperty method in the Code within <# #> are statement blocks that appear within the body sample simple, in order to avoid distracting from the technique. of the TransformText method that creates your output. <#+ #> are You’ll alter this to express the complexity of the property you need. class feature blocks that appear within the outputting class, but This approach is designed for complex properties or environments outside the TransformText method. This is how you define fields, where the output may change over time. If you have several types of properties, methods and nested classes used by your template. properties, you can either add modifiers as parameters to the Property The SupportCommon.t4 defines the pseudo-DSL in methods in method or you can create additional pseudo-DSL methods such as a class feature block: ReadOnlyProperty. Choose the approach that offers a more readable DSL. You’ll probably extend the pseudo-DSL in other ways as well, private string _itemName; such as supporting MEF, Windows Communication Foundation or private List _properties = new data-annotation attributes. List(); You can also extend this technique to keep interfaces and the properties of the corresponding implementations in sync. Define private void Item(string name) the in-line DSL directly at the point of the interface. At the point { _itemName = name; } of the implementation, create a template with a .TT extension that has an include directive that references the in-line DSL private void Property(string name, string typeName) definition template. The implementation template can use a { _properties.Add(new PropertyStuff() {Name=name, different Support.t4 with different include directives to create the TypeName=typeName}); } implementation output, or you can define a field that indicates

Generation whether interface or implementation output is desired. .NET Code Once the graph is built, the Run method outputs your code: There are a couple of gotchas to watch out for. In the past and current versions of the T4 processor, relative paths in include private void Run() directives are always relative to the entry template regardless of { where the include directive appears. For example, a relative path in Import("System"); an include directive in the SupportCommon.t4 template would be Import("System.Collections.Generic"); evaluated relative to the in-line DSL template. This really causes OutputFileStart(nspace, _imports.Distinct()); headaches in solutions with a project tree that varies in depth. OutputClass(_itemName); Visual Basic will require a modified DSL, and a bit more work. The foreach (var prop in _properties) pseudo-DSL aims for natural English semantics—the way we’d really { OutputProperty(prop.Name, prop.TypeName); } speak the code. As a result of this and the case-insensitive nature of Close(); Visual Basic, keyword collisions will occur with the pseudo-DSL I } used. You also need to track exactly what’s being closed rather than the generalized closing of curly brackets, making output a bit more In addition to the Property and Item methods, the pseudo-DSL complicated. If your team can remember to add semicolons at the end includes an Import method that allows you to add using statements. of lines in the in-line DSL template, you can use C# to output Visual You’ll Import items within the Run method when the using state- Basic by modifying the output methods in the SupportCommon.t4 ments are needed for the specific pattern you’re generating. You’ll file and adding an output directive defining the .VB extension. sometimes also need to add Import calls to the in-line DSL template Silverlight projects present extra challenges because they don’t or the Support.t4 template to define usings for property types. readily hit the correct System assemblies. You can add assembly The OutputFileStart method shows the importance of the T4 directives or generate into another project and link from your template infrastructure to manage the appearance of your output. Silverlight project. This pattern of local generation works best with The WriteLine method appends your output to a StringBuilder properties because they have a regular pattern. Effective use of T4 and manages horizontal white space via the PushIndent and requires separate files for the generated and handcrafted portions PopIndent methods. I keep track of the bracket level that allows of your classes—which you can easily provide using partial classes. them to be simultaneously closed: This approach can reduce the amount of time you spend creating and updating patterns in repetitive sections of code. private void OutputFileStart(string nspace, IEnumerable imports) Q: In Silverlight I want to display a list of complex bound criteria, { which includes data, child data and photos for each item. The foreach (var import in imports) requirement is for the list to be displayed horizontally with only { WriteLine("using " + import + ";"); } one item displayed at a time. Is this possible? WriteLine(""); A: There are at least two approaches to solving this: a ListBox and a WriteLine("namespace " + nspace); DataForm. In Silverlight 3, I wasn’t able to scroll the ListBox WriteLine("{"); incrementally, resulting in partially displayed items. In some cases bracketLevel ++; this might be desirable, but the DataForm offers a clean incremental PushIndent(" "); scroll. Figure 1 (p. 36) shows the DataForm solution. Both } approaches use a DataTemplate that allows reuse of control layouts. For my tests, I created a class with FirstName, LastName and The OutputClass and OutputProperty methods are similar and PhotoUri properties as well as a list of PhoneNumbers. Phone Number you can explore them in the download that accompanies this is a separate class with a Description and Number property. A shared article, available at VisualStudioMagazine.com/Dollard0410. I’ve method in the Customer class returns dummy data for the sample.

34 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com DynamicPDF…Proven .NET Components for Real-Time

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 { ASK KATHLEEN }

The downside of using the horizontal ListBox is that it doesn’t offer an integral move to the next item with a single click on the left or right Figure 1. One way you can use a DataForm is to pair it with a scroll button, and as the user scrolls, partial records are displayed. ScrollBar for horizontal and incremental scrolling behavior. An easy way to get integral move behavior is to combine a DataForm with a ScrollBar. The DataForm can also reuse the data App.xaml holds two DataTemplates—one for the phone number templates, showing how powerful data templates can be in and one for the customer. The phone number DataTemplate is providing a consistent and stylable user experience: simple; in a real project I’d ask an artist to fix it up later: EditTemplate="{StaticResource CustomerDataTemplate}" CommandButtonsVisibility="None"/> Orientation="Horizontal" Scroll="dataFormScrollBar_Scroll" Minimum="0" Path=Description}" Grid.Row="0" Grid.Column="0"/> The rather oddly named ViewportSize is actually the size of the thumbnail. The scroll event synchronizes the DataForm position with the scroll bar position:

The customer DataTemplate uses the phone number DataTemplate: Private Sub dataFormScrollBar_Scroll( _ ByVal sender As System.Object, _ Good scroll bar behavior requires setting the maximum values to The CustomerDataTemplate displays the image using the string URI: the count of items in the data set loaded. If you’re committed to reducing your code behind, you could do this in a value converter, but in this case I just set the value when I loaded data in the constructor:

This works because the PropertyUri is a string and there is a default Public Sub New() converter that changes the string Uri to an actual image. If you are InitializeComponent() working with a true Uri, you can write a value converter. You can Dim customers = Customer.GetDummyData() explore the rest of the CustomerDataTemplate in the download. Me.DataContext = customers The CustomerDataTemplate is used by a bound ListBox to dataFormScrollBar.Maximum = customers.Count - 1 display the associated data: End Sub

application with compelling approaches. VSM

Creating a ListBox that scrolls horizontally is not difficult. By Kathleen Dollard is the chief technologist for AppVenture (www.appventure.com). default the ListBox uses a VirtualizingStackPanel to display She has been a Microsoft MVP for 11 years and is a member of the INETA elements. You can replace this panel with any other panel. To create Speaker’s Bureau. Dollard has worked extensively with application code a horizontal ListBox, I defined the ItemsPanel to be a StackPanel generation and is the author of “Code Generation in Microsoft .NET” (Apress, with the Orientation set to horizontal: 2004). She speaks at dozens of conferences and user groups each year, and is also active in the Northern Colorado .NET SIG, Denver Visual Studio User Go to VisualStudioMagazine.com/Dollard0410 to read and download the sample code for this article.

36 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Untitled-1 1 3/12/10 9:03 AM 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 outperforms 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-2 1 3/16/10 10:39 AM Advertising Sales Ad Index

ID Statement Advertiser Page East Visual Studio Magazine (ISSN 1537-002X) is /n Software Inc. 7 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 19 postage paid at Chatsworth, CA 91311-9998, and at www.altova.com [email protected] additional mailing offi ces. Complimentary subscrip- AppDev Training 25 tions are sent to qualifying subscribers. Annual www.appdev.com West subscription rates for non-qualifi ed subscribers are: Aspose C4 Chris Kourtoglou U.S. $34.97, Canada $52.97 (U.S. funds); Interna- www.aspose.com tional $78.97 (U.S. funds). Subscription inquiries, Regional Sales Manager ceTe Software 35 back issue requests, and address changes: Mail www.cete.com Phone: 650-787-9515 to: Visual Studio Magazine, P.O. Box 2166, Skokie, IL dtSearch 32 [email protected] 60076-7866, email [email protected] or call www.dtsearch.com toll free (888) 768-8759, fax number 847-763-9564. ESRI, Inc. 9 www.esri.com International calls 847-763-9135. POSTMASTER: National Accounts Director Send address changes to Visual Studio Magazine, GrapeCity FarPoint C3 www.fpoint.com William Smith P.O. Box 2166, Skokie, IL 60076-7866. Canada Phone: 603-886-3466 Infragistics C2, 1, 11, 38 Publications Mail Agreement No: 40612608. Return www.infragistics.com [email protected] Undeliverable Canadian Addresses to Circulation Dept. LEAD Technologies, Inc. 5 or IMS/NJ. Attn: Returns, 310 Paterson Plank Road, www.leadtools.com Carlstadt, NJ 07072. Micro Focus 37 Microsoft Account Manager www.microfocus.com Danna Vedder Copyright Statment Programmer’s Paradise 2 Phone: 253-514-8015 © Copyright 2009 by 1105 Media, Inc. All rights www.programmers.com dvedder@11 05media.com reserved. Printed in the U.S.A. Reproductions in whole TechExcel, Inc. 13 www.techexcel.com or part prohibited except by written permission. Mail requests to “Permissions Editor,” c/o Visual Studio VSLive! 26, 27 http://vslive.com Director, Print Production Magazine, 230 California St. Suite 302, San Francisco, Jenny Hernandez-Asandas CA 94111. Phone: 818-814-5289 Fax: 818-734-1528 Legal Disclaimer Editorial Index The information in this magazine has not under- [email protected] Advanced Micro Devices Inc. 31 Production Coordinator gone any formal testing by 1105 Media, Inc. and is www.amd.com distributed without any warranty expressed or implied. Axosoft LLC 10 Serena Barnes Implementation or use of any information contained www.axosoft.com Phone: 818-814-5367 herein is the reader’s sole responsibility. While the IBM Corp. 40 [email protected] information has been reviewed for accuracy, there is www..com [email protected] no guarantee that the same or similar results may be Intel Corp. 31 achieved in all environments. Technical inaccuracies www.intel.com may result from printing errors and/or new develop- PreEmptive Solutions LLC 8 ments in the industry. www.preemptive.com

Corporate Address Corporate Headquarters: 110511 Media 929201 Oakdale Ave. Ste 101, Chatsworth, CA 91311 wwww.1105media.com

MediaM Kits DirectD your Media Kit requests to Matt Morollo, VP Publishing,Pu 508-532-1418 (phone), 508-875-6622 (f(fax), [email protected]

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 GO TO VP Publishing, 508-532-1418 (phone), Direct. Phone: 914-368-1000; E-mail: 1105media@ VisualStudioMagazine.com 508-875-6622 (fax), [email protected] meritdirect.com; Web: www.meritdirect.com. to access the stories in this issue, plus read exclusive online-only content.

VisualStudioMagazine.com · April 2010 · VISUAL STUDIO MAGAZINE 39 BY ANDREW J. BRUST Open Data, Open Microsoft

I’ve always been a data guy. I think data maintenance, sharing and Dallas and OGDI data is easily accessible from .NET using Astoria analysis is the inspiration for almost all line-of-business software, client technology, and from Excel using PowerPivot. And because and technology that makes any or all of it easier is key to platform Microsoft created Astoria “bridges” for both PHP and Java, developers success. That’s why I’ve been interested in WCF Data Services on those platforms have easy access to Dallas and OGDI data as well. (previously ADO.NET Data Services) since it fi rst appeared as the Because OData is based on XML, HTTP and REST, anyone with a Web technology code-named “Astoria.” Astoria was based on a crisp idea: browser has direct access to these data streams, too. For one representing data in AtomPub and JSON formats, as REST Web technology to enable so many data-consumption scenarios—each with services, with simple URI and HTTP verb conventions for querying a minimum of special setup requirements—is pure poetry in software. and updating the data. Astoria, by any name, has been very popular, and for good reason: It OData Beyond Microsoft provides refreshingly simple access to data, using modern, well- IBM has used OData to implement its WebSphere eXtreme Scale established Web standards. Astoria provides a versatile abstraction REST data service, providing access to the IBM eXtreme Scale data layer over data access, but does so without the over-engineering or grid from all the client endpoints I’ve discussed. The best part is that tight environmental coupling to which most data-access technologies fall prey. This elegance has enabled Microsoft to do something equally unusual: separate Astoria’s protocol from its implementation and publish that protocol as an open standard. We learned that Microsoft For one technology did this at its Professional Developers Conference (PDC) this past to enable so many data-consumption November in Los Angeles, when Redmond offi cially unveiled the scenarios—each with a minimum technology as (OData). This may have been one of Microsoft’s smartest data-access plays, ever. of special setup requirements—is pure poetry in software. Data Lingua Franca The brilliance behind separating and opening Astoria’s protocol has many dimensions. Microsoft is already reaping rewards from OData in IBM did this without any help from the OData team; the technical terms of unprecedented interoperability among a diverse array of its friction was that low. own products. Windows Azure table storage is exposed and consumable Microsoft is doing great things here, and I wonder if people are using OData; SharePoint 2010 lists will be accessible as OData feeds; taking notice. While pundits and luminaries debated technology and the data in SQL 2008 R2 Reporting Services reports—including and government at confabs like the Personal Democracy Forum in data visualized as charts, gauges and maps—will be exposed in OData New York this past summer, an off -campus group of Microsoft format. To tie it all together, Microsoft PowerPivot (formerly code- employees applied their company’s technology to make government named “Gemini”) will be able to consume any OData feed and data sharing concrete and easy. And while many in the industry integrate it into data models that also contain table data from fault Microsoft for not innovating or serving interoperability, OData relational databases. PowerPivot models can then be analyzed in shows that Microsoft does both. Excel, making OData relevant to the vast majority of business users. Meanwhile, the innovation and benefi ts of OData remain a But the benefi ts go beyond Microsoft products and technologies. well-kept secret. It’s true that Microsoft needs to promote OData The Microsoft cloud data feed platform, code-named “Dallas,” is better. But the industry press and analysts need to discard their based on OData and already serves a wide array of commercial and stereotypes of Redmond and cover OData for the newsworthy United Nations agency data. It provides an easy way for any organi- technology that it is, as well. VSM zation to publish its data online. In the same vein, a group within the Microsoft fi eld organization has created something called the Andrew J. Brust ([email protected]) is chief of new technology for Open Government Data Initiative (OGDI), on which platform—and consultancy twentysix NewYork, as well as a Microsoft regional director and open source starter kit—local governments and even the U.S. MVP. He’s also the co-author of “Programming Microsoft SQL Server 2008” General Services Administration are publishing their data online. (Microsoft Press, 2008).

40 VISUAL STUDIO MAGAZINE · April 2010 · VisualStudioMagazine.com Untitled-4 1 2/9/10 2:23 PM Untitled-1 1 1/29/10 10:18 AM