Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2006

Tip: Looking for answers? Try searching our database.

How to add IDL to assembly?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alexbalaev@yahoo.com - 24 Oct 2006 17:02 GMT
Hello,
First of I am very new to .NET 2.0... sorry if the question is very
basic.
Here is the deal.
We used to develop in COM (VS 6.0). We have a bunch of objects that use
the same interface. The interface is in an IDL file, shared between the
projects.
Now we're switching to .NET 2.0 (VS 8.0) but we want to use the same
interface, the same GUID and so on so that newly created .NET DLL (in
C#) can be loaded by our *old* process and get used through the same
interface.
The IDL is really simple and the .NET is a fresh project:
--------------------------------------------------------------------------------------------
    [
       object,
        uuid(),
        dual,
        helpstring("IMyInterface Interface"),
        pointer_default(unique)
    ]

    __interface IMyInterface: IDispatch
    {
        [id(1), helpstring("method")]
        HRESULT Method([in]BSTR xmlInput, [out]BSTR* xmlOutput);
    };

--------------------------------------------------------------------------------------------
I would appreciate any help on how it could be done.
TIA, Alex.
Mattias Sjögren - 29 Oct 2006 21:16 GMT
Alex,

>I would appreciate any help on how it could be done.

You can declare and use the same interface in C#. It would look
something like this

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
[Guid(...)]
interface IMyInterface
{
    [DispId(1)]
    void Method(string xmlInput, out string xmlOutput);
}

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

alexbalaev@yahoo.com - 30 Oct 2006 17:38 GMT
Mattias,
Thanks!
Maybe you could help me on another one :)
I assume that this attiribute will work as regular (COM) registration,
correct?
If yes I want to add this newly created .NET dll into a particular
category.
For instance in .NET 1.1 i could do

[ module(dll, uuid = "{FBA1520A-7255-4D93-8293-979A89D3B471}",
        name = "MyObject",
        helpstring = "MyObject 1.0 Type Library",
        resource_name = "IDR_MYOBJECT") ]
class CMyClass
{

}

How to express it in .NET 2.0???
Thanks in advance, Alex.

> Alex,
>
[quoted text clipped - 18 lines]
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Mattias Sjögren - 05 Nov 2006 15:01 GMT
>I assume that this attiribute will work as regular (COM) registration,
>correct?

In what way? The attributes themselvs don't do much. The registration
of assemblies is handled by RegAsm.exe.

>If yes I want to add this newly created .NET dll into a particular
>category.

If you need to do custom registration, check out the
ComRegisterFunctionAttribute.

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.