Code Red > .NET

C# and Com Interop

(1/3) > >>

Draftek:
I have written a small xml config class to manipulate xml files similar to the old ini file usage.

I decided to try and expose this thru com interop so I could use it in some old vb or unmanaged c++ apps if needed.

After doing the following:
1. created a strong name using the sn utility.
2. added a Guid attribute to the public class
3. Changed the compile for com interop to 'true' in the visual studio configuration dialog

I'm able to add the class as a reference and use in a vb project correctly but - I can't see any of the methods or properties in intellisense or the object browser in vb. Almost like late binding is occuring or something.

Did I forget to do something?

Glenn R:
Just had a quick look thru a book I have here and all public types and type members will be visible to COM.

You can control this even further with the [ComVisible(false)] attribute.

Cheers,
Glenn.

Draftek:
Thanks Glenn, I read that too, and all the methods work, I just can't see them in the IDE.

Odd.

MickD:
This is only a guess but your assembly holds all your information about your application and I think your exported function names should appear in there so the clr can make them available/visible to other apps or COM (similar to a dll's exports). Do you have any export type attributes for all of your public functions?

Glenn R:
This should explain a few things:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp

Navigation

[0] Message Index

[#] Next page

Go to full version