Fw: Com Interop error!!!

  • Thread starter Thread starter Ramakant
  • Start date Start date
R

Ramakant

Hi,

I have created a component say MyAssembly.dll in .net and gave it t strong
name.
I have compiled the dll with 'Register for COM Interop' to true. Then I used
Regasm to register it and create a tlb to use it in VB6.0. It works on my
machine but dosent work on other machine. I get an following error

"file or assembly name MyAssembly, or one of its dependencies, was not
found"

thanks in advance.

Ramakant
 
Hello Ramakant,

Does the component depend on any other COM object and other machines don't
have it?
 
Thanks for the reply,

As suggested by Sahil, I have tried to distribute the com component with
setup and it worked.

Regards,

Ramakant
 
Add this installation helper class in the class-library project and then
include the library in custom-actions for the installer project. You can
also override other methods and get more out of the installation helper
class.


// ... Other using directives
using System.Runtime.InteropServices;

[RunInstaller(true)]
public class InstallHelper : System.Configuration.Install.Installer
{

public override void Install(IDictionary stateSaver) {
base.Install (stateSaver);

RegistrationServices regsrv = new RegistrationServices();
if (!regsrv.RegisterAssembly(this.GetType().Assembly,
AssemblyRegistrationFlags.SetCodeBase))
throw new InstallException("Failed to register for COM interop -
component not usable in ASP");
}

public override void Uninstall(IDictionary savedState) {
base.Uninstall (savedState);

RegistrationServices regsrv = new RegistrationServices();
if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
throw new InstallException("Failed to unregister for com");
}

// .... Other Methods

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top