"Ricardo Vázquez" <(E-Mail Removed)> wrote in
news:#(E-Mail Removed):
> I need to use a .NET DLL I've written in C#, within a VC++ 6.0/MFC
> project. Googling I find plenty of topics related with using a VC++
> DLL in a .NET project...
> But I need exactly the other way round: a .NET DLL in a VC++ project.
> Is this possible?
> How do I import the .net dll to the vc++ project? (both the .net dll
> and the vc++ project are my code)
The short answer is set up a COM callable wrapper. This can be as simple
as using tlbexp.exe (type library export) and creating the wrapper. I
believe you have to register the wrapper in the registry, but this is
fairly easy to do. You can google tblexp.exe for more info on the
command line tool.
Regasm.exe shortens the steps a bit, as it handles a couple of tasks,
but, if I remember correctly, you can regsrv32.exe the wrapper if you
need basic COM support. I would double check this.
As for "both in same project and need a project reference", it is not
going to happen with interop, so you have to separate the two out a bit.
Logical separation (in your head) may be enough, but putting in two
projects may be easier to ensure you keep the wrapper updated with the
assembly. It really depends on how you work.
Peace and Grace,
Greg
--
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************