我用C#昨天创建了一个COM对象,导致我的VS 2010项目的bin/release目录中有三个文件(comclass.dll,comclass.pdb和comclass.tlb).现在,当我在项目中构建解决方案时,VS会在开发PC上自动为我注册该类,我可以从Powershell访问COM对象及其方法.但是,当我将这三个文件复制到另一台机器并尝试使用regsvr32注册dll时,它告诉我
模块"comclass.dll"已加载但未找到入口点DllRegisterServer.
确保"comclass.dll"是有效的DLL或OCX文件,然后重试.
使用.tlb文件中regasm的/tlb参数给我一个类似的消息.所以我有点难过.有谁知道我应该怎么从这里开始?
我正在创建一个使用 regasm 将 .NET 程序集注册到 COM 的安装程序。不同的客户端将在其计算机上安装不同的 Microsoft.Net 版本。我需要提前知道高潮位置才能使用它。
我应该只在以下位置寻找它还是还有其他可能的位置?
C:\Windows\Microsoft.NET\Framework\v2.0.50727\ C:\Windows\Microsoft.NET\Framework\v1.0.xxx\ C:\Windows\Microsoft.NET\Framework\v4.0.xxxx\
它可以出现在以下位置吗?
C:\Windows\Microsoft.NET**Framework64**\vx.xx
我创建了一个类并使其可见:
[ComVisible(true)]
[Guid("FD909333-3CD0-477F-8A7E-B8045B0B84EC")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("TestComApp.TestApp.TestClass")]
public class TestClass:ITestCom
{
public int Add(int a, int b) { return a + b; }
}
Run Code Online (Sandbox Code Playgroud)
接口也设置为 COM 可见:
[ComVisible(true)]
[Guid("26567B41-15DB-4EE2-A277-357EAE96BF6A")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
interface ITestCom
{
int Add(int a, int b);
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试注册 DLL 时
regsvr32 /i TestComApp.dll
Run Code Online (Sandbox Code Playgroud)
我收到以下错误“模块已加载,但未找到入口点 DLLRegisterServer”