1

I have a C# DLL that has "Register for COM interop" set to true. Everything worked fine until I added a new interface in this DLL and changed name of one of the methods in an existing interface.

Now after doing this, I recompile and try to use these interfaces in my legacy application, I get errors like Undeclared identifier "name of the interface". I am unable to use any of the methods of the interface. I have checked in this code on source control and compiling this code on any other machine works fine. So there is nothing wrong with the code for sure.

Here is how I declared the interface

[ComVisible(true), Guid("9A8A1B45-190B-4263-826E-6A83E8C13712")]
public interface IArcImporter : IArcObjectsErrorHandler
{
    string ConnectToArcOnline();
    string GetServerName();
}

I have tried to register the DLL using regasm as well but nothing seems to be working. I am getting compile time errors. If I undo my changes, then both the projects compile fine. While same changes on other machines are working fine.

halfer
  • 19,824
  • 17
  • 99
  • 186
WAQ
  • 2,556
  • 6
  • 45
  • 86
  • Using the [Guid] attribute is in general *very* unwise, COM interface are immutable and it is rock-hard requirement to change the guid when the interface is changed. In this case you probably didn't get them all, like the guid for the class that implements the interface or the guid of the type library. Whatever tool you use to consume this code needs to re-reference the new type library. – Hans Passant Sep 05 '14 at 04:05
  • my client code is using the tlb file that is generated. How should I reference that? – WAQ Sep 05 '14 at 04:11
  • I have no reasonable guess, you didn't describe your client-side tooling at all. In general, such tools store the guid of the type library. Not valid anymore if it changed. You'd have to do something like removing the type library, then adding it back. – Hans Passant Sep 05 '14 at 04:32
  • But I did not change any GUID. I added a new method to an existing interface and created a new Interface – WAQ Sep 05 '14 at 05:06

0 Answers0