Office client developer enhancements with VS 2010

At the Office Developer Conference last year Bill Gates remarked, “If you look at the success of our software or any software, this emphasis on it being a platform, reaching out to developers, having great tools has been the key to its success.”

Since the beginning, Office has included features which enable developers to extend the Office applications and allow them to become a better functional fit. With the introduction of Visual Studio Tools for Office in 2003, we ensured that .NET developers could easily build solutions which integrate back-end business data into the standard Office applications that are used on a daily basis.

Visual Studio 2010 extends this and includes some dramatic improvements which will ease the development, deployment, and management experience for your solutions which complement the Office suite.

Installation and configuration is often the most challenging task for Office developers. For VS 2010, we have focused on providing developers and IT professionals the flexibility needed to customize the deployment experience while simplifying some of the common challenges faced by all Office developers. We recognize that it is critical for developers to be able to ensure a smooth end-user installation experience, particularly when the solution being deployed provides access to the business‑critical data that information workers need to do their jobs. There are three key improvements we’re making in VS 2010 timeframe:

 

1. PIA-less Interoperability

If your solution uses the CLR v4.0, you’ll be able to use a new feature which will embed a closure of the interop type interfaces your solution needs directly in your application assembly. This reduces the overall application footprint by removing the 6.3Mb PIA redist file and embedding only those interop types used. And, you’ll have one less worry during installation.

2. Publish to SharePoint

When we introduced ClickOnce deployment for Office solutions with Visual Studio 2008, you could easily publish solutions to a Web site, UNC share, or CD/DVD media. With VS 2010 you’ll be able to publish documents to SharePoint servers as well. This means that you no longer have to manually upload the document to SharePoint and maintain a network location from which the assemblies are installed when the document is opened. Simply select a SharePoint Document Library as an option in the publish wizard and the customized document will be added to the appropriate document library; the assemblies will be stored on the SharePoint server itself. This eliminates the requirement of having both a SharePoint server and a UNC share for deploying document solutions to SharePoint.

3. Customize the Deployment Package

As Office solutions become more sophisticated and provide integration across multiple Office applications and backend data sources, you may require more customization during install. With VS 2010, you can deploy multiple solutions in a single deployment package, so your users can install both Word and Excel add-ins at once. You’ll also be able to include post deployment which will run after the solution has been installed. This allows you to set up a database connection, add registry entries, or copy documents to the end user computers.

At the PDC in 2008, Anders Hejlsberg introduced several new C# features in VS 2010 which will dramatically simplify interoperating with COM based OMs exposed in Office. For instance, in the following example, we just want to save the document of the object doc to the filename Test.docx. This is what you’d write today:

object fileName = "Test.docx";

object missing = System.Reflection.Missing.Value;

doc.SaveAs(ref fileName,

    ref missing, ref missing, ref missing,

    ref missing, ref missing, ref missing,

    ref missing, ref missing, ref missing,

    ref missing, ref missing, ref missing,

    ref missing, ref missing, ref missing);

With VS 2010, the previous code changes to one simple line!

object fileName = "Test.docx";

doc.SaveAs(fileName);

Another new language feature of C# is named arguments. Those of you who familiar with VB but who use C# may appreciate the added readability and flexibility this adds to your code.

var result = namedRange.Find(

              MatchCase: true,

              What: "dog",

              SearchOrder: XLSearchOrder.xlByRows);

With Visual Studio 2010 and .NET FX 4.0, we want to continue making it easy for you to build and deploy .NET based solutions for Office.

Namaste!