Bump.
I have a dll that is marked with "Register .Net assembly for COM Interoperability"
It's an Excel addin so it has a <ComRegisterFunctionAttribute()> and a <ComUnregisterFunctionAttribute()> that contains calls to code that sets up the necessary registry entries.
AI does not seem to be calling RegAsm (or the equivalent) and my ComRegister function is not being called (I have a msgbox in it to let me know it has run)
In order to get the registration to work and my addin to run properly with Excel, I have to go to an elevated cmd prompt, change to [appdir] and run regasm manually after the AI setup msi finishes:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm my.dll
The result is that the expected msgbox from my custom registration code is displayed and RegAsm reports that the registration completed successfully. My addin then functions properly in Excel.
This setup is being run on a Win 7 x64 machine. This machine also has the trial version of Visual Studio 2010 installed if that makes any difference. (VS 2010 installs the .NET 4 framework)
My addin uses an older version of the .NET framework but is built with VS 2010 (on a different machine).
Here are the ComRegister and ComUnregister routines that are contained in the main class module of the addin which is contained in my.dll.
my.dll is marked with "Register .Net assembly for COM Interoperability" . These routines are not called when AI installs the dll. They are called when regasm is run:
Code: Select all
<ComRegisterFunctionAttribute()> Public Shared Sub _
RegisterFunction(ByVal t As Type)
If bDebug Then
MsgBox("Register: " & My.Application.Info.AssemblyName)
End If
Dim friendlyName As String = AppProductName
Dim desc As String = AppProductName
Dim loadBehavior As Integer = 3
Dim commandLineSafe As Integer = 0
Dim reg As New clsRegisterOfficeCOMAddin("Excel", AppProgId, False, True)
Dim bAutomation As Boolean = True
reg.RegisterAddinWithOfficeApp(friendlyName, desc, loadBehavior, commandLineSafe, bAutomation)
End Sub
Code: Select all
<ComUnregisterFunctionAttribute()> Public Shared Sub _
UnregisterFunction(ByVal t As Type)
If bDebug Then
MsgBox("UnRegister: " & My.Application.Info.AssemblyName)
End If
Dim reg As New clsRegisterOfficeCOMAddin("Excel", AppProgId, False, True)
Dim bAutomation As Boolean = True
reg.UnRegisterAddinWithOfficeApp(bAutomation)
End Sub
FOLLOW US
Get the latest news in Application Packaging