开发者

using [interopformproperty] prevents wrapper.cs file generation

开发者 https://www.devze.com 2023-02-10 14:42 出处:网络
I have a problem/question with some basic stuff. I have interoptoolkit v2.1 installed and I am trying to create this form in vs 2008 with C# so this form can be accessed from a vb6 application.

I have a problem/question with some basic stuff. I have interoptoolkit v2.1 installed and I am trying to create this form in vs 2008 with C# so this form can be accessed from a vb6 application.

I am tr开发者_开发百科ying to add a public property on this form, so I am thinking I am supposed to add this [interopformproperty] above the property.

But when I do this and try to generate the wrapper using the option under Tools menu, it doesn't generate the wrapper.

I obviously searched google for a while but I couldn't find something particularly helpful. So if you know anything about this, please give us hand.

Thanks a lot in advance. Cheers.


If the com visible type implements an interace, all the public methods, properties are com visible, provided that the types uses in their signatures are com visible. If the com visible type implements multiple interfaces, the first one (in the class definition) is used as the com interface. This behavior can be changed using the ComDefaultInterfaceAttibute.

If an interface is not implemented, all the public properties (that expose a com visible type) are automatically com visible. regasm automatically generates a com inteface, containing all public methods/propties.

"Generating a wrapper" as you say... I don't understand this. After compiling an assembly with com visible types register it using regasm (if the option in project properties "Register for COM interop is not active).


I always end up answering my own question :D I am doing this just in case someone else get on this.

Go to this link and download the 2nd file.

C_Interop_Form.aspx">http://www.codeproject.com/KB/dotnet/VB6_-C_Interop_Form.aspx

Assuming you are using vs2008. Get the dll file, and the add in file.

and copy this file into My documents -> visual studio 2008>addins

Open up the addin file with notepad, and change the version number 8.0 -> *

Now save it. and reload vs2008. It should generate the wrapper file in C# instead of vb.

P.S, reading the comment of the post always helps :D

0

精彩评论

暂无评论...
验证码 换一张
取 消