C#程序调用COM组件,编译调试一切正常,但如果我要把编好的C#程序和COM组件运行在其它的电脑上时,应该如何搞定?在其它电脑上注册COM后,C#仍然无法找到COM组件,从而无法运行。谢谢。

解决方案 »

  1.   

    讲具体问题比较容易分析,是什么COM,其它电脑是如何注册的,出错信息是什么。
      

  2.   

    是个通常的问题,C#中调用了C++的一个COM,编译后会在BIN文件夹里自动生成对应COM的Interop.XXX.dll文件,通过这个文件能C#找到对应的COM,但当这些文件拷到另一台机器后就无效了,因为新的机器上的COM组件可能注册在另一个地址,所以当我把C#程序,COM,interop文件拷到另一台机器中,并注册COM,但C#程序还是不能运行,说是找不到COM的接口。
      

  3.   

    你还是没有提供更多的信息 :-)COM的激活机制是根据COM的Guid和COM的注册信息来做的,跟COM运行文件的安装路径没有关系。而Interop.x.dll已经包含了Guid信息了。
      

  4.   

    当打开程序时会出现如下错误信息。
    Could not load file or assembly 'Interop.MMCliLib, Version=2.10.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
      

  5.   

    It is not yet calling the COM.
    The problem is ... one of its dependencies1. So try copying everything under your bin\debug folder.
    2. Try searching for anything that registered in you GAC but not in the problematic machine.