1

I have a simple C# class with COM attributes:

[ComClass("1DC7B465-49FA-4ad1-893E-C19657E1ED25", "F97459E6-AB37-43e6-AC57-6AE5F9A9A835", "BD9F01C7-162A-4f95-9398-C126C152B965")]
    [ComVisible(true)]
    public class Class1
    {

    }

I need to use this class from VB6 application. It works well until I change AssemblyVersion of .NET dll. Then VB6 doesn't create C# class instance (throws an ACtiveX exception) until I recompile it (VB6 application).

It is interesting that I do not need to recompile Class1 if it is written in VB.NET.

What is the difference between C# and VB.NET here? Is there any way to make C# behave like VB.NET?

1
  • what is the ActiveX Exception being thrown? Commented Aug 20, 2010 at 5:25

2 Answers 2

1

The most likely difference is between the standard AssemblyInfo.cs and AssemblyInfo.vb generated by the two project wizards. You can compare these two to see if any of the assembly level attributes differ. Btw, I would bet on the version attributes.

Sign up to request clarification or add additional context in comments.

Comments

1

I looked into assemblies generated by C# and VB.NET compiler and found out VB.NET generates Guid attribute in addition to ComClass attribute. C# doesn't do it. So I have added Guid attribute to C# class explicitly and it solved my problem.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.