Creating and deploying Managed COM add-ins with VB.NET 2005 – Part VIII

Creating and deploying Managed COM add-ins with VB.NET 2005 – Part VIII
You can find the earlier post on the subject at the following links:
Part I – Introduction
Part II – Connection
Part III – Notes Tool – Workbooks
Part IV – Notes Tool – Worksheets
Part V – Notes Tool – Main functions
Part VI – COM Shim Wizard
Part VII – Strong Name & Digital codesign

Some additional code for the Notes Tool
I’ve received several e-post about the code behind the ‘Recipients’-button in the two forms the tool use. There is no connection to Lotus Notes or to Domino’s global address book. It simple retrieves the e-mail address from a selected range as the following snippet code shows (the RefEdit control is not available and therefore the InputBox is used instead):

            g_xlRng = CType(g_xlApp.InputBox( _
                                  “Please select the range that  _
                                  contain the list of recipients as Copy To:”
, _
                                  g_CONST_TITLE, , , , , , 8), Excel.Range)
            g_xlcell = CType(g_xlRng.Cells, Excel.Range)
                ‘Add recipients to the list of Send To.
               If Not g_xlRng.Columns.Count > 1 Then
                    With Me.ListBox_SendTo
                        For Each g_xlcell In g_xlRng
                            If Not (g_xlcell.Value) Is Nothing _
                            Then .Items.Add(g_xlcell.Value)
                        Next g_xlcell
                    End With
                    MsgBox(“The list of recipients can only be in one column.”, _
                    MsgBoxStyle.Information, g_CONST_TITLE)
                End If
            Catch ex As Exception
                MessageBox.Show(ex.ToString, g_CONST_TITLE)
            End Try
        Catch ex As Exception
            ‘Leave empty – it takes care of the cancel for the inputbox.
            ‘Release the objects.
           If Not g_xlcell Is Nothing Then g_xlcell = Nothing
            If Not g_xlRng Is Nothing Then g_xlRng = Nothing
        End Try

Test and preparations
Before doing anything else we need to test the ‘shimmed’ managed COM add-in and the generated standard COM DLL. The simplest way is to first copy the ‘shimmed’ managed COM DLL file (together with the help file) to the folder where the generated COM DLL file is placed and then start to debug it.

When the COM SHIM Wizard has created the files it has also registered the generated standard COM DLL file on the developing machines. Since it’s a standard COM DLL it uses the regsvr32.exe.

Creating the Installation Package
We can either add a Setup project to the Com Shim generated project or create a standalone Setup project. I prefer the later for clarity in the walkthrough. The Setup Wizard can be a good start, especially if we are inexperienced with .NET.

The most important aspect is to decide which files should be included in the Setup package. The following picture shows the minimal number of files for the NotesTool and as You can see a help file is also included:


Since the NotesLoader.dll is a standard COM DLL we need to set the Register properties for it to ‘vsdrfCOMRelativePath’. As for the other files settings we can leave them as they are.

The following picture shows some additional entries we can add to the Setup package:

Properties Setup

Don’t forget to add the KB908002 to the prerequisities for the Setup project. When building the Setup the package will include the installation package for KB908002 but You’ll need to install it separately and before the installation of the tool itself.

Installation of the Notes Tool
Before starting the installation of the tool it’s absolutely necessary to check that:

1. The latest SP is installed for the actuall version of Windows
2. The correct version of Excel with the latest SP is installed
3. The correct version of .NET Framework is installed
4. The correct version of the PIA is installed
5. All fixes that refer to 1 to 4 above are installed on the target machines.

If all the above preparations are done then it’s just to install the tool.

I find the deployment tool in VB .NET to be much easier and more smoother to work with then with the tool provided in VB 6.0.

In the next post I will discuss troubleshooting when things don’t work out as they supposed to do.

Kind regards,

Posted in Uncategorized

5 thoughts on “Creating and deploying Managed COM add-ins with VB.NET 2005 – Part VIII

  1. I’ll look forward to that next post Dennis! I had a good look at this over the weekend and had quite a few problems, I think casued by the fact that my VS installantion was not very good! I could not get the “My Project” to dispaly any properties, and thus could not set the start with Excel options to debug! so I only got to the second post!!!

    Oh well, when time permits I’ll tray agian! – Still very intresting to read.

  2. Ross – Sorry to disappoint You but the next post will not cover issues with VS.NET 2005 itself only when it comes to ‘managed’ COM add-ins.

    Select Project from the commandbar and then the last entry on the menu, i e NotesTool Properties.

    Kind regards,

  3. Ross – Thanks for the info and I’ve saved the URL in case that I get some issues myself :)

    Please keep me posted about the progress. I’m preparing a new series about managed Add-ins with VSTO CTP 3.0 and Excel 2007. It’s very interesting to see how smoother it is to work with Add-ins in VSTO.

    Kind regards,

  4. Hi Dennis,

    Yeah, I got a “Hello world” addin to work, but have had some issues with the code as posted, but when time permitts I’ll look through it all and work it out. I spent a bit of time looking up PAI nad it seems that you “might” be able to run 2003 solutions with addin using XP PAI, i.e only need to build one. Not sure if this is a good idea, but i installed the XP PAI set in my GAC and my “hello world” addin worked in XL03, soo…..

    Thanks Dennis, we really do appreciate all you work, some time I look at those MSDN articals, and think bugger it I wait till it’s easier!

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.