Tim Williams
Tim Williams

Reputation: 166835

Issue implementing public interface in C#

C# class libary - targetting .NET2 framework.

I'm trying to implement a public interface (exposed from a second referenced assembly) in a small class. The interface has only 3 methods: one is fine, but for some reason I can't implement the other two of them without the compiler complaining for each one that:

The only difference between the one method which compiles and the other two is that the problem methods each have a parameter which is an Office Interop (Word) type. The other parameters are either bool or members of other public interfaces.

I can add my class definition here if it helps, but I would need to do some paraphrasing since I'm not the "owner" of the other assembly (it is a commercial product) and I'm not sure how they'd feel about me "exposing" it...

That's kind of vague I know, but I'm hoping someone's run into this kind of error before.

Thanks for any pointers.

Upvotes: 0

Views: 281

Answers (1)

Pete
Pete

Reputation: 11505

This can often happen if the referenced assembly is built against a different version of the Office Interop assemblies.

As a result, even though visibly the parameters declared for "MethodName" may appear to match the interface from the referenced assembly, since the assembly versions are different, the method declaration does not actually match the decleration from the referenced assembly.

Double check you are using the exact same version of the interop assemblies.

Upvotes: 3

Related Questions