Click here to Skip to main content
15,907,236 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
A client of mine has a Native (Win32) deskstop App developed with VS 2010, they want to discontinue a couple of modules of it. The new functionality of these modules was given to us by a software vendor in a C# desktop App developed with VS 2015.

I have to find out if it´s possible to merge this new characteristics into the old App, but I don´t want to code all again. I am very concerned about the different versions of IDE's. Maybe I'll have to convert the old one to VS 2015. I don't think I could do the opposite.

What I mean is to include a C# App as a module for a MFC C++ App.

The C# app is pointing to the 4.5 Net framework.

I´m searching thru the Net to see if I can get to what my client wants. If not, I´ll have to figure out what should be the best solution I can give to solve the problem, maybe to code again the C# App into C++, not the other way, the MCF is a very large app, and I don´t know this language well yet. But I´ll really appreciate if somebody could get me to achieve this, or to advice me where to find documentation or examples of preceding and solved projects like this.

Thanks in advance.

What I have tried:

I´m in the process of studying both applications and searching for an appropiate solution. I have a little more practice in C# than in C++, but still I have to deal with learning process of both languages and discover the answer for what I need.

It´s been very difficult for me, maybe I should not accepted this project, but I really need the money.
Posted
Updated 23-Aug-16 5:05am
v2
Comments
Garth J Lancaster 22-Aug-16 20:55pm    
I think you need to define this "include a C# App as a module for a MFC C++ App" a little better - if you mean 'share code', then thats really hard, see Philippe Mori's response - if you mean run the C# App from the MFC App, then thats not so hard - you just use CreateProcess from the c++ side. Obviously if you need to share data that the c# app creates in the c++ app, you need to be careful, but its not impossible .... please refine your 'requirements' a bit (use the green Improve question widget at the bottom of your question)
Miguel Altamirano Morales 23-Aug-16 10:54am    
Thanks a lot Garth, please excuse me, I don´t speak english at 100%, sometimes I can´t explain myself clearly.
this is the situation: My client has a Native (Win32) deskstop App developed with VS 2010, they want to discontinue a couple of modules of it. The new functionality of these modules was given to us by a software vendor, in a C# desktop App developed with VS 2015.
My goal is to merge this new characteristics into the old App, but I don´t want to code all again. I´m very concerned about the different versions of IDE´s. Maybe I´ll have to convert the old one to VS 2015. I don´t think I could do the opposite.

Philippe Mori´s response seems to be very appropiate for this. But I´ll have to search for each point on it.
Philippe Mori 23-Aug-16 12:50pm    
It is somewhat hard to follow. It look like that the C++ already have all functionality but the client does not want some so it was removed. Then it seems you got back that functionality and want to put it back in the application. Thus why you would not create 2 applications. One that include everything and another that does not include a couple of modules?

Also, if you add back that functionality in C#, you would have the same problem that the application include modules the client does not want?

It would probably be best for you to have all projects in VS 2015. Is it required? It is hard to tell as it depends on which framework your application target and if the code depends on new compiler features.
Miguel Altamirano Morales 23-Aug-16 13:07pm    
The functionality of the C++ has not been removed because I´m still searching for what to do, and is working fine, but the client does not wants to use it anymore. It is working with an external device and this is going to be changed. I´m sorry I can´t give more details.
Yes, I tought about using the two apps separately, but all the captured data must go to the same database, encrypted, and to another one, in XML, to be sent to the web via another app. Anyway, maybe this is a better option, I´ll analize it.
Thank you very much, Philippe.

1 solution

If you want to include some part of the C# application in the C++ application, then one possibility would be to do something similar to this:

1) Create a library from the C# application so that a DLL is built.
2) If you still need the C# application, only keep minimal stuff in the application itself (EXE).
3) Create a mixed-mode (C++/CLI) assembly for interop purpose.
4) From that assembly, reference the C# assembly created in step #1.
5) Add the C++/CLI assembly to the C++ application project
6) Write code in the mixed-mode assembly to bridge C# and C++ code.

This assumes expert level...
 
Share this answer
 
Comments
Miguel Altamirano Morales 23-Aug-16 12:32pm    
Yesterday I wrote a comment for you, Philippe, being grateful for your answer and making a couple of questions more.

I don´t see this message in the page, should I assume it was not received (or I did´t send it ?)
Philippe Mori 23-Aug-16 12:42pm    
If something is not there, I haven't receive it so you probably didn't send it...

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