Add a Custom Task Pane to Project 2010 (Norm Estabrook)
02 February 10 01:21 PM

Good news! Project 2010 supports custom task panes! Bad News! Getting one to appear in a Project 2010 is not so obvious. Good News! It’s a lot easier than I make it sound.

In this post, I’ll show you how to add a custom task pane to Project 2010 by using a Project 2010 or Project 2007 project template in Visual Studio.

The “skinny” on task panes in Microsoft Office Project

Project 2007 does not support custom task panes. Project 2010 does support custom task panes. The thing that might throw you off is that the Project 2010 project template in Visual Studio does not expose that cool CustomTaskPanes field. You know, that field that enables you to access a CustomTaskPaneCollection object by typing this.CustomTaskPanes or Me.CustomTaskPanes?

No worries. We can just create a CustomTaskPaneCollection object ourselves. The exact code that you use to accomplish that depends on the .NET Framework version that your project targets.

For now, add a User Control item to your project. This provides the design surface for your custom task pane. Next, identify which version of the .NET Framework you are targeting. If you created a brand new Project 2010 project, then odds favor that your project targets the .NET Framework 4.  However, it never hurts to check. Here is a helpful topic that shows you how to examine that little piece of info -  How to: Target a Specific .NET Framework Version or Profile.

After you do all of that, add this code:

For projects that target the .NET Framework 4:

[VB]

    Private myUserControl1 As MyUserControl
    Private myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane
    Private myCustomTaskPaneCollection As Microsoft.Office.Tools.CustomTaskPaneCollection

    Private Sub ThisAddIn_Startup() Handles Me.Startup
        myUserControl1 = New MyUserControl
        myCustomTaskPaneCollection = Globals.Factory.CreateCustomTaskPaneCollection _
        (Nothing, Nothing, "CustomTaskPanes", "CustomTaskPanes", Me)
        myCustomTaskPane = myCustomTaskPaneCollection.Add(myUserControl1, "My Task Pane")
        myCustomTaskPane.Visible = True
    End Sub

    Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        myCustomTaskPaneCollection.Dispose()
    End Sub

[C#]

    private MyUserControl myUserControl1;
    private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;
    private Microsoft.Office.Tools.CustomTaskPaneCollection myCustomTaskPaneCollection;

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        myUserControl1 = new MyUserControl();
        myCustomTaskPaneCollection =
            Globals.Factory.CreateCustomTaskPaneCollection
            (null, null, "CustomTaskPanes", "CustomTaskPanes", this);

        myCustomTaskPane = myCustomTaskPaneCollection.Add(myUserControl1, "My Task Pane");
        myCustomTaskPane.Visible = true;

    }

    private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
    {
        myCustomTaskPaneCollection.Dispose();
    }
For projects that target the .NET Framework 3.5:

[VB]

    Private myUserControl1 As MyUserControl
    Private myCustomTaskPane As Microsoft.Office.Tools.CustomTaskPane
    Private myCustomTaskPaneCollection As Microsoft.Office.Tools.CustomTaskPaneCollection

    Private Sub ThisAddIn_Startup() Handles Me.Startup
        myUserControl1 = New MyUserControl
        myCustomTaskPaneCollection = New Microsoft.Office.Tools.CustomTaskPaneCollection _
            (Me.ItemProvider, Me.HostContext, "MyTaskPane", Me, "MyTaskPane")
        myCustomTaskPane = myCustomTaskPaneCollection.Add(myUserControl1, "My Task Pane")
        myCustomTaskPane.Visible = True
    End Sub

    Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        myCustomTaskPaneCollection.Dispose()
    End Sub

[C#]

    private MyUserControl myUserControl1;
    private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;
    private Microsoft.Office.Tools.CustomTaskPaneCollection myCustomTaskPaneCollection;

    private void ThisAddIn_Startup(object sender, System.EventArgs e)
    {
        myUserControl1 = new MyUserControl();
        myCustomTaskPaneCollection = new Microsoft.Office.Tools.CustomTaskPaneCollection
                (this.ItemProvider, this.HostContext, "MyTaskPane", this, "MyTaskPane");

        myCustomTaskPane = myCustomTaskPaneCollection.Add(myUserControl1, "My Task Pane");
        myCustomTaskPane.Visible = true;
    }

    private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
    {
        myCustomTaskPaneCollection.Dispose();
    }

Want to Use a Project 2007 project? No problem. Check this out.

So what if you are using Visual Studio 2008 and you do not have a Project 2010 project template?  No problem. Project 2010 can host a Project 2007 add-in. All you have to do is configure your project settings to open the Project 2010 executable on start up. The name of that executable file is WINPROJ.exe.

Right click your project node in Solution Explorer, click Properties, click the the Debug tab, and point away! Here is a screenshot of how I did it.

image

Norm E.

 

VSTO 2010 Runtime components explained (Aaron Cathcart)
21 January 10 05:26 PM

 

During development of the VSTO 2010 Runtime we added a feature, dubbed Install on Demand, to support VSTO customizations that target both .NET Framework 3.5 and .NET Framework 4 without enforcing installation of both frameworks prior to installation of VSTO 2010. To facilitate this we needed to break the runtime into 3 components as shown in this diagram.

Picture4

VSTO Loader can be viewed as the native component of the VSTO 2010 Runtime that communicates with Office. It has no managed dependency and is the only component of the VSTO 2010 Runtime that is guaranteed to be “turned on” no matter how the runtime is installed (the different installation scenarios are discussed below). The extensions (Office 3.5 Runtime Extensions and Office 4.0 Runtime Extensions), shown above VSTO Loader, are the components necessary to execute customizations that target the corresponding version of the .Net Framework. The red arrows indicate which .Net Framework version the extensions depend on.

To better understand how the new Install on Demand functionality will affect you and your end users I will explain the impact from the 3 distinct scenarios with which the VSTO 2010 Runtime can be installed.

  • Visual Studio 2010
  • Office 2010
  • VSTO 2010 Runtime redistributable

Because of these different scenarios we could not assume (or enforce a prerequisite) that any particular version of the .NET Framework was installed on an end users machine at the time they install the VSTO 2010 Runtime. To make this clear, imagine you are deploying a customization that targets .Net Framework 3.5 to a customer who has not yet moved to .Net Framework 4. If we were to unconditionally install all 3 components in the diagram above we would be forced to prereq the .Net Framework 4 which would mean your customer would have to install .Net Framework 4 even though your customization would not require it. Similarly, if you were deploying a customization that targets .Net Framework 4 to a customer that has .Net Framework 4 and no .Net Framework 3.5 we would have to prereq .Net Framework 3.5. What we did was to allow the extensions to only be “turned on” once the version of the .NET Framework that they depend on was present. As a result of the Install on Demand design we have made it more flexible for developers and end users to install the VSTO 2010 Runtime "once" and forget about it. No manual configuration of VSTO is required after installing a version of the .Net Framework that “lights up” either of the extensions.

Visual Studio 2010

VSTO 2010 Runtime, as it has been in past Visual Studio releases, is chained in with the Visual Studio 2010 installation. Developers who install Visual Studio 2010 on a machine without .NET Framework 3.5 will have the Office 4.0 Runtime Extensions “turned on” and the Office 3.5 Runtime Extensions “turned off” (but ready to be “turned on” when applicable) as is shown here.

Picture3

If the developer decides to start creating .Net Framework 3.5 customizations they are going to need to install the .NET Framework 3.5. After the .Net Framework 3.5 installation when the developer launches Visual Studio 2010 they will be able to target .NET Framework 3.5. However, the VSTO 2010 Runtime still does not have the Office 3.5 Runtime Extensions “turned on”. No worries, this will be taken care of for the developer the first time they create a VSTO project that targets .Net Framework 3.5. During this initial project creation you will notice an MSI configuration dialog appear.

Untitled

When the project is successfully created the VSTO 2010 Runtime will have installed the Office 3.5 Runtime Extensions which will transition the runtime into the following state allowing the project to be F5’d.

Picture2

If .NET Framework 3.5 was on the box prior to the Visual Studio 2010 installation then the runtime will be installed in its entirety (both Office 3.5 and Office 4.0 Runtime Extensions “turned on”) and no Install on Demand will take place from that point on. 

Office 2010

If you weren’t already aware, VSTO 2010 will be included in the Office 2010 installation. This is great news for end users who will not have to install the VSTO 2010 Runtime redistributable to execute customizations that target .Net Framework 3.5. Note that in the Beta and RTM releases of Office 2010 you will NOT get Office 4.0 Runtime Extensions (or the capability for them to be “turned on”). If you are deploying customizations that target .Net Framework 4 and they will run on Office 2010 you will need your users to install the VSTO 2010 Runtime redistributable (and of course before their customization will run they will have to install .Net Framework 4).

End users who install Office 2010 will receive the VSTO runtime and the Office 3.5 Runtime Extensions “turn on” capability. That is, if .NET Framework 3.5 is on the machine then these extensions will be installed and “turned on” otherwise they will be ready to "turn on”.

Picture1

VSTO 2010 Runtime redistributable

End users who install the redistributable, either through the bootstrapper (setup.exe) or the download center, will receive both extensions and be able to run customizations that target both .Net Framework 3.5 and 4. No matter how the machine is configured, at the time the redistributable is installed, all deployed solutions will be able to run as long as the appropriate target .Net Framework version is present. Note that this is not limited to ClickOnce deployment, custom MSI deployment will also work this way. For customizations deployed via ClickOnce the “turning on” of extensions will occur during the installation process and for MSI deployment on first load of the customization. In both these cases users will see the MSI configuration dialog (shown in the image above) briefly.

In conclusion, Install on Demand coupled with the VSTO 2010 Runtime shipping with Office 2010 simplifies many deployment scenarios. End users of Office 2010 customizations that target .Net Framework 3.5 will never need to manually install the VSTO 2010 Runtime nor know of its existence. Those still using Office2007 or Office 2010 with .Net Framework 4 will have the flexibility to install the VSTO 2010 Runtime without worrying if they have the correct .Net Framework down before doing so.

Postedby VSTO Team | 0 Comments    
Northwind Office Business Application Updated for Visual Studio, Office & SharePoint 2010 (Beth Massi)
19 January 10 08:29 PM

Early last year we built a business application for order management for Northwind Traders on the Office and SharePoint platform using Visual Studio 2008 and Office & SharePoint 2007. Recently I started releasing articles on my blog that show how to upgrade the VS2008 version to VS2010:

Today I updated the sample with some more goodies including some SharePoint 2010 web parts that I’ll write about soon. But I wanted to let you know sooner rather than later that you can play with all of the code today.

Here ya go: http://code.msdn.microsoft.com/OBANorthwind

This sample was built using Visual Studio 2010 Beta 2, Office 2010 Beta & SharePoint 2010 Beta and it demonstrates:

  1. A way to easily expose line-of-business (LOB) data using WCF Data Services (formerly known as ADO.NET Data Services)
  2. An Outlook 2010 Add-in that displays LOB data in a WPF control that I built in 5 minutes using the new drag-drop data binding and designer features
  3. How to store and retrieve structured data from Word 2010 documents
  4. An Excel 2010 document customization that edits LOB data through the data service and provides data visualization
  5. A SharePoint 2010 Document Library Workflow that adds Order info to the database by reading word documents and updates and reports order statuses based on changes in the database using the data service
  6. A SharePoint 2010 Visual Web Part that reports low inventory in the database using the data service and allows users to add tasks
  7. A SharePoint 2010 Silverlight Web Part that demonstrates how to deploy Silverlight web parts to SharePoint 2010 and use the SharePoint Silverlight client library to add tasks

Enjoy,
-Beth Massi, Visual Studio Community

VSTO Performance: Delay Loading and You (Stephen Peters)
07 January 10 11:04 AM

There have been a couple of blog posts about delay loading VSTO addins, and with Dev10 being released soon, it’s a good time to expand on the subject a little bit.

This has been covered before, and I’ll avoid spending too much time here on topics that have already been covered.  For an overview of delay loading, please read these posts.

http://blogs.msdn.com/andreww/archive/2008/07/14/demand-loading-vsto-add-ins.aspx

http://blogs.msdn.com/andreww/archive/2008/04/19/delay-loading-the-clr-in-office-add-ins.aspx

There are many reasons why you would want to delay load your addin, the most important of which is for performance – loading the CLR can easily double the amount of time that it takes to load an Office application. If your addin is only used occasionally, your users will appreciate the faster load times.

One important improvement that has gone into Dev10 is that you no longer need to manually change the LoadBehavior in the registry for your addin to make it DelayLoad. If you go into project properties of your addin, click on the “Publish” tab, and go into “Options…”, you can adjust the Add-in Load Behavior under “Office Settings”.

clip_image002

For more information about publishing, please see Publishing VSTO Solutions.

Now, once you have done this, your addin will not be loaded until Office decides that it needs to load the addin. This can happen a number of ways, but the most common is that a user action (like clicking on a ribbon button) calls into the addin, and causes the addin to be loaded.

One important note is that any custom “get” handler (getEnabled, getVisible, getLabel) will not trigger the loading of your addin. The first time that your addin is loaded, Office will call the handler and cache the response given, and use that response as the default.  It will then call the handler again to use in the current session.  This is important because if the control is disabled initially, and then later enabled via a call to RibbonUI.Invalidate or RibbonUI.InvalidateControl, it will only invalidate this second value and not the first value. 

Consider the following example where a database connection is necessary for the addin to function:

XML:

<group id="MyGroup"
       label="Database controls"  >
    <button id="Button1" label="Get Data" onAction="GetDataClick" getEnabled="GetEnabled" />
</group>

Callbacks in Ribbon Class:

#region Ribbon Callbacks
Boolean dbEnabled = false; 
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
    this.ribbon = ribbonUI;

    //[aDeveloper] moving the database connection to another thread
    Thread databaseConnectionThread = 
        new Thread(delegate()
        { 
            Thread.Sleep(500); // todo:  Actually connect
            dbEnabled = true;
            ribbon.Invalidate();
        });
    databaseConnectionThread.Start();
}

public Boolean GetEnabled(Office.IRibbonControl rc)
{
    return dbEnabled;
}

public void GetDataClick(Office.IRibbonControl rc)
{
    //pull data from the database and populate the spreadsheet with it.
}
#endregion

This can cause a chicken and egg type situation if by default none of its ribbon controls are available (Ie, they’re not enabled or visible). The next time Office is started, it will use the cached “false” response resulting in none of the controls being enabled, and the user will have no easy way to load the addin and cause the “get” handlers to be called.

The best way around this issue would be to have a control that is always enabled that calls into the addin and thus would load the addin. You can then call ribbonUI.Invalidate in the custom UI’s onLoad handler to force the Office application to call each “get” handler.

XML:

<group id="MyGroup"
       label="Database controls">
    <button id="Button0" label="Connect Database" onAction="ConnectDatabase" enabled="true" />
    <button id="Button1" label="Get Data" onAction="GetDataClick" getEnabled="GetEnabled" />
</group>

Callbacks in Ribbon Class:

#region Ribbon Callbacks
Boolean dbEnabled = false; 
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
    this.ribbon = ribbonUI;
}

public Boolean GetEnabled(Office.IRibbonControl rc)
{
    return dbEnabled;
}

public void GetDataClick(Office.IRibbonControl rc)
{
    //pull data from the database and populate the spreadsheet with it.
}

public void ConnectDatabase(Office.IRibbonControl rc)
{
    //[aDeveloper] we don't do this automatically since we don't want to connect to the database
    //             unless the user wants to - there's a chance for a hang if the database isn't
    //             available.
    Thread.Sleep(500); // todo:  Actually connect
    dbEnabled = true;
    ribbon.Invalidate();
}
#endregion

Another trick is to have the handler return “true” the first time that it’s called, so that Office caches the “true” response as the default, and the control is enabled.  If you do this, you’ll want to make sure that your click handlers can handle the case where the button should be disabled.

(n.b.:  This example is a little bit contrived, but will illustrate what you need to do if your application would be best served by this behavior.) 

In this case, the “Get Data” button will be enabled by default.  The first click will generate the message box since by the time that GetDataClick is called, the addin hasn’t had time to ‘connect’, and the button will remain disabled until the connection is done.

XML:

<group id="MyGroup"
       label="Database controls">
    <button id="Button1" label="Get Data" onAction="GetDataClick" getEnabled="GetEnabled" />
</group>

Callbacks in Ribbon Class:

#region Ribbon Callbacks
Boolean dbEnabled = false;
Boolean firstCall = true;
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
    this.ribbon = ribbonUI;
    //[aDeveloper] moving the database connection to another thread so that we don't hang office
    Thread databaseConnectionThread = 
        new Thread(delegate()
        { 
            Thread.Sleep(5000); // todo:  Actually connect
            dbEnabled = true;
            ribbon.Invalidate();
        });
    databaseConnectionThread.Start();
}

public Boolean GetEnabled(Office.IRibbonControl rc)
{
    if (true == firstCall)
    {
        firstCall = false;
        return true;
    }
    return dbEnabled;
}

public void GetDataClick(Office.IRibbonControl rc)
{
    if (false == dbEnabled)
    {
        System.Windows.Forms.MessageBox.Show("Could not connect to database");
                
        //Disable this button until we get the connection up.
        firstCall = false;
        ribbon.Invalidate();
        return;
    }
    //Get the data and populate the spreadsheet
}
#endregion
Migrating an Outlook Solution to .NET Framework 4 in Visual Studio 2010 (Norm Estabrook)
16 December 09 02:33 PM

Visual Studio can help migrate your Outlook solutions from .NET Framework 3.5 to the .NET Framework 4. However, you still have to do a few things manually to make it all work. 

Beth Massi converts an Outlook Solution that targets the .NET Framework 3.5 to an Outlook Solution that targets the .NET Framework 4 client profile in this very cool and informative blog entry - Migrating an Outlook Client to .NET Framework 4 in Visual Studio 2010.

Making a Custom Group Appear in the Message Tab of a Mail Item (Norm Estabrook)
15 December 09 02:14 PM

You can add a custom group to the Message tab of an Outlook mail item.  For example, here is a custom group named "MyCoolGroup" that I added to the message tab of a new message:

image

Outlook lets you open a message in the following two modes:

  • Compose (you are drafting a new message).
  • Read (you are reading a message). 

Making a custom group appear for only one of these modes is pretty easy.  Making it appear for both modes is a tad more challenging. That is because the control ID of the Message tab in read mode is different than the control ID of the Message tab in compose mode. When you design your custom group in the VSTO Ribbon designer, you can only specify one control ID. This means that when you run the project, the custom group will only appear in the Message tab of a compose window or the Message tab of a read window depending on which control ID you specify at design-time.

If you want the group to appear in both versions of the Message tab (read and compose), you have to do a bit more work. Here is how you make the group appear for both modes:

First, add a Ribbon (Visual Designer) to an Outlook 2007 add-in project.

Then, set the RibbonType property of the Ribbon to Microsoft.Outlook.Mail.Read as follows:

image

On the Ribbon designer, add a group to a tab and customize the group as desired. 

On the Ribbon designer, select the tab, open the Properties window, and then set the OfficeId of the tab to TabReadMessageTabReadMessage is the control ID of the default tab that appears on the Ribbon of a mail message that is open in read mode. 

image

Ok. Now when you run the project, your custom group will appear only if you open a mail item in read mode. Now you need to add second Ribbon to your project to display this custom group in a mail item that is open in compose mode.

Add a second Ribbon (Visual Designer) to the project. Then, set the RibbonType property of the Ribbon to Microsoft.Outlook.Mail.Compose as follows:

image

On the Ribbon designer, select the tab of the second Ribbon, open the Properties window, and then set the OfficeId of the tab to TabNewMailMessageTabNewMailMessage is the control ID of the default tab that appears on the Ribbon of a mail message that is open in compose mode. 

I know what your thinking. Do you mean I have to create two separate custom groups? That defeats the whole point of trying to do this right?  Yes that would. Fortunately, you don’t have to create two custom groups. You only have to create two Ribbons as I have shown here. You can use the same custom group in both Ribbons.  Here is how:

Open the first Ribbon that you created in the Ribbon Designer.  In the Ribbon Designer, select your custom group. In the Properties window, set the Modifiers property of the group to Public.

Open the code file of the second Ribbon that you created (called Ribbon2 in my project).

In the constructor of the second Ribbon, add the custom group from Ribbon1 to Ribbon2 as follows:

public Ribbon2()
{
    InitializeComponent();
    Ribbon1 firstRibbon = new Ribbon1();
    this.tab1.Groups.Add(firstRibbon.group1);
}

You can read more about adding custom groups to built-in tabs in the following MSDN articles:

How to: Customize a Built-in tab

How to: Get Started Customizing the Ribbon

Ribbon Designer

Customizing a Ribbon for Outlook

Office Development with Visual Studio 2008 Tutorial Series – Part 2(Beth Massi)
08 December 09 10:36 AM

Last month Robert Green, VSTO MVP, started a series of tutorials on building on Office 2007. Today we published part 2 of his step-by-step tutorials.

In this second part of the series of tutorials on Office Business Applications, learn how to create a Word 2007 price quote generation solution using Visual Studio 2008. This tutorial shows you how to create a custom task pane to display data from a database and binding that data to content controls. This step-by-step tutorial also includes full source code in Visual Basic and C#. Check out the tutorial on the VSTO Developer Center:

Building an Office Business Application Part 2 – Generating Automobile Quotes

And if you missed part 1:

Building an Office Business Application Part 1 - Scheduling Customer Appointments

If you’re just getting started with Office development in Visual Studio, this is a great place to start.

Enjoy,
-Beth Massi, Visual Studio Community

Postedby VSTO Team | 0 Comments    
Using Office 2010 Extensibility Schemas with VSTO addins for Beta 2 (Stephen Peters)
04 December 09 02:06 PM

Office 2010 brings in many new features to the Ribbon and Backstage extensibility. In order to take advantage of those changes in VSTO addins, you will need to update your ribbon XML projects to use the new Office 2010 schema.

First, you will need to see if the schema is installed. To do this, look in “C:\Program Files\Microsoft Visual Studio 10.0\Xml\Schemas\1033” (you might need to modify this to point to your Visual Studio installation directory). If customui14.xsd is there, you can skip ahead to the next paragraph. Otherwise download the schema from here, and install it in the directory above. When you are done, double check to make sure that the custom14ui.xsd file is there.

Go to the Ribbon XML item that you want to use on Office 2010. For this blog post I am going to use a Word 2010 addin with a single Ribbon XML item, but the same code can work with any VSTO project with only minor modifications.

At the top Ribbon1.xml, there is a line

  <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">

You will want to replace the URL with

  http://schemas.microsoft.com/office/2009/07/customui

If you look in the properties window for the XML document, the schema for the document should now point to the customui14.xsd that was installed. Now we can play around with it a bit. Under </ribbon> in Ribbon1.xml, add the following code:

  <backstage>
    <tab id="VSTOTab" label="VSTO Tab" insertAfterMso="TabInfo">
      <firstColumn>
        <group id="VSTOGroup" label="Hello From VSTO!">
          <topItems>
            <button id="AddMoreCowbell"
              label="Add More Cowbell"
              onAction="AddMoreCowbell" />
          </topItems>
        </group>
      </firstColumn>
    </tab>
  </backstage>

We will also need to add the callback to Ribbon1.cs:

public void AddMoreCowbell(Office.IRibbonControl control)
{
    System.Windows.Forms.MessageBox.Show("Fever Cured");
}

And, of course, the integration in ThisAddin.cs

protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
    return new Ribbon1();
}

Run your add-in, and when you go to the backstage, you will find the backstage tab that we just added:

clip_image002

Now that you have the schemas set up, you can read up more on extending Backstage and new Ribbon features here:

Microsoft Office 2010 Technical Articles

    - Customizing the Office 2010 Backstage View for Developers

    - Ribbon Extensibility in Office 2010: Tab Activation and Auto-Scaling

Office 2010 Custom UI Schema (repost from above)

New Learning Resources on the VSTO Developer Center (Beth Massi)
01 December 09 05:37 PM

Last week we revamped the Learn pages on the VSTO Developer Center with more content that allows you to pivot on more fine-grained topics and tasks under each type of Office solution. We’ve changed the layout of these pages so that you can browse for a type of solution (right now we have Excel, Word, Outlook and Deployment) and then you can drill down into the specific topics to reveal articles and videos underneath. As you select a topic on the left, the content changes on the right so check it out.

image

We’ve gone through and picked key content in the Visual Studio and Office MSDN libraries, other Developer Centers and blogs like this one to bring you a better integrated learning experience -- especially if you’re just getting started programming Office solutions with Visual Studio. Let me know what topics I’ve missed by making a comment to the end of this post or by contacting me directly and I’ll get them added. Also let me know how you like this layout, we’re planning on taking this approach to the Visual Basic and C# Developer Centers as well.

This is a work in progress so you’ll see more content being added to the site as I find it.  I suggest making the VSTO Developer Center your home page so you don’t miss a beat ;-).

Enjoy,
-Beth Massi, Visual Studio Community

Postedby VSTO Team | 2 Comments    
Filed under: ,
Office 2010 Beta & SharePoint 2010 Beta Now Available to the Public (Beth Massi)
18 November 09 10:54 AM

Monday Office and SharePoint 2010 Beta were released to MSDN/TechNet subscribers. Today it was announced at PDC that these are available to the rest of the public! Come and get it…

Office 2010 Beta

SharePoint 2010 Beta

These Betas are compatible with Visual Studio 2010 Beta 2 which was released to the public a few weeks ago. We’ve also started a series on Channel 9 on SharePoint development in Visual Studio so check that out starting with:

Overview of SharePoint Development in Visual Studio 2010

Also check out…

Office 2010 resources

SharePoint 2010 Resources

And stay tuned here for more posts on Office Development with Visual Studio 2010!

Enjoy,
-Beth Massi, Visual Studio Community

Office & SharePoint 2010 Betas Available! (Beth Massi)
16 November 09 11:05 AM

Office and SharePoint 2010 are available for MSDN Subscribers today:

MSDN Subscribers: Office 2010 Beta is here.

MSDN Subscribers: Microsoft Sharepoint 2010 Beta is here.

These versions of Office and SharePoint are compatible with the Visual Studio 2010 Beta 2 that was released a couple weeks ago. Check out these resources and please let us know what you think.

Office 2010 resources

SharePoint 2010 Resources

Also keep an eye out on Channel 9 today for an overview of some of the Visual Studio 2010 tools that make Office and SharePoint Development easy.

Enjoy!

Postedby VSTO Team | 0 Comments    
Office 2010 Application Compatibility Program (Beth Massi)
28 October 09 09:46 AM

If you missed it, Office announced a compatibility program to help IT and developers who have built add-ins make a seamless upgrade to Office 2010.  We want you to have a successful and seamless migration to Office 2010 for your VSTO solutions. The program provides tools for environment assessment, code scanning and remediation assistance, and an update to the document conversion tools introduced with Office 2007.

Check out Michael Kiselman’s post for more details on the program that will be available in early December.

Enjoy,
-Beth Massi, Visual Studio Community

Postedby VSTO Team | 0 Comments    
Visual Studio 2010: Specify advanced publishing options (Saurabh Bhatia)
19 October 09 03:31 PM

I have previously posted how you can specify various properties for a VSTO solution like the Publisher and Product Names by tweaking a few files in Visual Studio 2008.

With Visual Studio 2010 (Beta 2) you can edit these properties directly through the Publish Page. All Office projects in Visual Studio 2010 now have an Options button on the Publish Page, which allows you to spet these properties.

image 

The Publish Options dialog is similar to the ClickOnce publish options dialog for other types of projects, but this dialog only displays the options applicable to Office projects.

image

Here is what these properties mean:

Publisher Name – The name of the Publisher as displayed in Programs and Features

Product Name – The name of the Solution as it will show up in the Programs and Features (Add Remove Programs Entry)

Support URL – A URL which End Users can visit to get support for this particular solution. The support URL shows up as a clickable link for the product name during the installation trust prompt.

 

image 

Solution Name – (Friendly Name) This is the name of the Add-In as it is displayed in the Office Add-ins dialog.

Office Application Description – The description of the Office Add-in as displayed in the Office Add-ins dialog.

Add-in Load Behavior – Specifies whether the add-in should load when the Office Application Starts up or whether it should load on demand when the end user tries to interact with it. By default all add-ins are set to load at startup of the Office Application but if you care about Office startup performance and don’t want your add-in to be running all the time then you should consider loading it on demand.

Andrew Whitechapel has a post on how an Office add-in can be demand loaded using different loadbehavior values. Previously you had manually update the ClickOnce manifests with the appropriate load behavior value. With Visual Studio 2010 you can set the option to load the add-in on demand and the loadbehavior will be automatically set to 16 (connect first time) –> Load the add-in on startup for the first time and then load on demand from then on.

Loading an add-in on demand can help improve the startup performance of the Office application. It can also reduce the application’s working set as the add-in is not loaded in memory until the end user interacts with it. Setting the add-in to demand load is a good option if your add-in has UI based triggers, like a Ribbon item that the end user can interact with to load the add-in. However demand loading may not be a good option if your add-in is needs to listen to application events like opening a document etc all the time the application is running. So if your add-in doesn’t have to run all the time, then setting it to Load on Demand is a good option to consider.

Lastly, there is an interesting side note for those of you who may have changed their VS 2008 based project files based on my previous post. If you updated the project file using the same property names as that mentioned in the post, you can migrate that project to VS 2010 and continue using those property values. You no longer need the custom targets file as that functionality is now directly available in the Visual Studio common targets.

For more information, see Publishing Office Solutions.

Have fun with Visual Studio 2010 Beta2 and let us know your feedback!

Saurabh

Can I deploy my <Insert App Name Here> and all of its prerequisites in one file? (Mary Lee)
14 October 09 03:16 PM

One frequent customer question is about how to deploy an application and all of its prerequisites in a single .msi or .exe file. This question applies whether you are deploying any of the following:

  • Microsoft Office 2003 solutions with dependencies on .NET Framework 2.0, Visual Studio Tools for Office 2005 SE runtime, Microsoft Office 2007 primary interop assemblies.
  • Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 , Visual Studio Tools for Office runtime 3.0, Microsoft Office 2007 primary interop assemblies.
  • Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 SP1, Visual Studio Tools for Office runtime 3.0 SP1, Microsoft Office 2007 primary interop assemblies.
  • Microsoft Office 2007 solutions with dependencies on .NET Framework 3.5 SP1 Client Profile, Visual Studio Tools for Office runtime 3.0 SP1, Microsoft Office 2007 primary interop assemblies.
  • Really, any WinForms/WPF/console/whatever app with dependencies on .NET Framework, SQL Server Express, SQL Server compact, Visual C++ runtime, Windows Installer, or anything else.

 

There are three concepts in deployment related to prerequisites: nesting, merging, and chaining or bootstrapping.

Nesting is the process of embedding a Windows Installer file (.msi) within another .msi file. However, the How to create a nested .msi package article has an important disclaimer.

image

The drawbacks of creating a nested MSI installation are listed in the same article.

  • Nested Installations cannot share components.
  • An administrative installation cannot contain a nested installation.
  • Patching and upgrading will not work with nested installations.
  • The installer will not correctly cost a nested installation.
  • Integrated ProgressBars cannot be used with nested installations.
  • Resources that are to be advertised cannot be installed by the nested installation.
  • A package that performs a nested installation of an application should also uninstall the nested application when the parent product is uninstalled.

For these reasons, nesting is no longer supported.

 

Merging includes shared code, files, resources, registry entries, and setup logic to applications as a single compound file. Prerequisites available as a merge module (.msm) form can be added to a .msi file. For example, if a prerequisite is available as an .msm, you can add it to a Setup project in Visual Studio as shown in How to: Create or Add a Merge Module Project. However, merge modules cannot be serviced by the same owner as the .msi file, so it is difficult to fix issues in the merge module. Tao of the Windows Installer, Part 4 lists two cautionary notes:

  • Do not consume merge modules of vendors who do not promise to fix their merge modules promptly when bugs arrive
  • Be prepared to handle the heat when bugs are found in your merge module causing issues for others’ products that have consumed your merge module and you get to put out the flame

For these reasons, using merge modules is not recommended.

Nesting and merging create a single file to deploy an application and its prerequisites, but these methods are not supported and not recommended. Thus, the answer to the question in the title is no: you cannot or should not deploy an application and its prerequisites in one file.

 

Chaining or bootstrapping is the process of checking for and installing missing prerequisites, including installing the application that is going to be used to install the rest of the prerequisites and application. You can use Visual Studio to generate a chainer/bootstrapper that is called Setup.exe. This program checks for and installs missing prerequisites before installing the application or Office solution.

If you are deploying an Office 2007 solution in Visual Studio 2008 SP1, the .NET Framework 3.5 SP1, Visual Studio Tools for Office 3.0 SP1 runtime, and Microsoft Office 2007 primary interop assemblies are already selected in the Prerequisites Dialog Box.

To learn more about how to install prerequisites in Visual Studio, see the following topics.

How to: Install Prerequisites on End User Computers to Run Office Solutions

How to: Install Prerequisites in Windows Installer Deployment

How to: Install Prerequisites with a ClickOnce Application

If the prerequisite package does not appear in Visual Studio, you can create your own bootstrapper package. After you create a product.xml file that describes the prerequisite and a package.xml files that includes locale-specific error messages, you can copy the bootstrapper package to \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages folder. For more information, see Creating Bootstrapper Packages.

Other tools besides Visual Studio: You can also use MSBuild and the GenerateBootstrapper Task to create a bootstrapper on a build computer. Alternatively, you can use the Windows Installer XML Toolset to generate .msi files and package prerequisites. For more information, see http://wix.sourceforge.net/.

 

For questions about bootstrapping, search for answers or post new questions in the ClickOnce and Setup & Deployment forum.

 

Happy deployment!

Mary Lee, Programming Writer.

Office Development with Visual Studio 2008 Tutorial Series Started (Beth Massi)
14 October 09 09:25 AM

Robert Green, VSTO MVP, has started a series of tutorials on building on Office 2007! Thanks Robert! 

In this first of a series of tutorials on building applications on Office you’ll learn how to create an Outlook 2007 customer appointment management solution using Visual Studio 2008. This step-by-step tutorial also includes full source code in Visual Basic and C#. Check out the tutorial on the VSTO Developer Center:

Building an Office Business Application Part 1 - Scheduling Customer Appointments

If you’re just getting started with Office development in Visual Studio, this is a great place to start.

Enjoy!

More Posts Next page »

This Blog

Syndication

Page view tracker