我的团队最近对VB.NET组件进行了一些更改,我们在QA实验室中遇到了一些主要问题,一直在注册用于Excel的组件。但是,"它适用于我的机器"综合症导致我们头痛。
设置:
第一项是我们被要求不使用regasm来注册程序集,因为安装程序是在使用缺少管理权限的帐户的计算机上自动生成的。在开发人员的计算机(具有管理员权限)上,我们创建一个.reg文件(regasm /reg VBNET.dll
)并将其合并到安装程序中。
另一个变化(我负责)是我重构了VB.NET类以摆脱使用autodual,并创建特定的接口和实现。它们具有以下代码的模式。通过这样做,注册COM组件可能会出现任何问题吗?
Option Strict Off
Option Explicit On
Imports System.Runtime.InteropServices
<InterfaceType(ComInterfaceType.InterfaceIsDual)> _
<Guid("ABCD1234-FOO-BOO-ETC-GUIDHERE")> _
Public Interface ICorePoint
<DispId(1)> Property PointX() As Double
<DispId(2)> Property PointY() As Double
<DispId(3)> Property PointZ() As Double
<DispId(4)> Function Distance3D(ByVal ptB As ICorePoint) As Double
End Interface
' Implement the interface (in the same file)
<ProgId("CalculationCore_NET.CCorePoint")> _
<ClassInterface(ClassInterfaceType.None)> _
<Guid("A-DIFFERENT-GUID-HERE"> _
Public Class CCorePoint
Implements ICorePoint
Private m_x As Double
Private m_y As Double
Private m_z As Double
Public Property PointX() As Double Implements ICorePoint.PointX
'Implemented here'
End Property
'Repeat other implementations here
End Class
最后一个变化是C ++ COM Server在我们分支产品版本时获得了全新的GUID。我们使用regsvr,到目前为止我们没有任何问题。
我的团队很难过,现在正在尝试各种各样的事情,从耗费谷歌到排出多瓶啤酒。我希望可能会有一些建议/指示如何让我们通过这个。
作为后续问题,我们不会将这些注册到GAC,并且历来使用regasm /tlb /codebase THEDLL
进行注册。我不确定/我不认为生成tlb的命令启用了/codebase
标志。这会导致我们尝试做的重大问题吗?