Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how I sais on the other question I must use a library c# in an mfc app..I need CLI but I don't find it...I have visual studio 2015..I searched on internet and I don't know how I must use CLI.

What I have tried:

I searched on internet but I don't find it
Posted
Updated 23-Feb-23 21:59pm
Comments
Andre Oosthuizen 23-Feb-23 10:21am    
I am sure this question were asked earlier on... Search for "how to use a C# file in C++" in Google, it returns tons of information that you can choose from.
Member 14594285 23-Feb-23 10:25am    
yes but I have an other problem I don't find cli in my visual studio 2015..Must I reinstall it?
Rick York 23-Feb-23 12:08pm    
No, you don't have to reinstall. You can just add that to your existing installation.
Shao Voon Wong 24-Feb-23 2:44am    
You need to enable the C++/CLI on your MFC project. Right-click on your MFC project in the solution explorer and click "Properties" at the bottom of the popup menu. On the property page, click on the advanced option on the left and select C++/CLI on the right bottom: https://imageshack.com/i/pmuTjyv7p

Then add your new C++/CLI class by right-clicking on the project and choose Add > Add New Item > C++ Class. Make sure "Managed" option is selected. https://imagizer.imageshack.com/img922/6696/atHxLe.png

Once you have created your C++/CLI class, access your C# class from there.
Member 14594285 24-Feb-23 6:10am    
Do you have an easy example that Can I see?

 
Share this answer
 
Read my article Calling all station with example code which demonstrates the use of that technology.

Best is also to read the documentation of your c# library. An easy solution maybe that you write also some C# code to use the library and only provide the result to C++. Maybe a file or graphic.
 
Share this answer
 
Comments
Member 14594285 24-Feb-23 5:18am    
yes I read but it's the opposite...it's c# that calls c++..I need c++ that calls c#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900