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
For Each g_xlcell In g_xlRng
If Not (g_xlcell.Value) Is Nothing _
MsgBox(“The list of recipients can only be in one column.”, _
Catch ex As Exception
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
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:
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.