Creating a c # winforms application that can be used as a dll from an unmanaged mfc application

I am wondering how I am going to convert an existing C # winforms application into a class library and then call it from the mfc application. Are there any links on how to do this? I tried a search on Google, but besides the fact that it would require the attribute ComVisibleset in true, I did not find much information.

Thank.

+3
source share
4 answers

In the visual studio project properties, change the type of output to the class library . This will compile your project in dll. Also set the comvisible attribute to true . This will create a COM calling shell and a tlb file, which you can use in your mfc project.

I also think that the following link is a very good and detailed explanation of how COM Interop works in .Net

http://www.codeproject.com/KB/COM/cominterop.aspx

+3
source

Take a look at the regasm.exe tool that comes with .NET. It will generate the necessary registry entries (and possibly a .tlb file) that will allow COM components to access your assembly.

+1
source

MSDN, Winforms MFC- - . , , .

+1

, . , , . WPF , . Google , .

0

Source: https://habr.com/ru/post/1762897/


All Articles