-5

I want to create 2 executable with only 1 executable. How can i do that in Visual Studio 2015? I looked in internet but couldnt find something. Is there any way i can do that without wizard? Simply there will be 2 project in 1 solution and project1's exe will create project2's exe. Or something that will do what i want.

The purpose is user will not have to download 2 separate exe, he will only download 1 and otherone will be created beside exe1( both program has different purposes, so exe1 will not be onl for creating exe2)

Elliot
  • 71
  • 1
  • 11
  • 2
    Your question makes no sense. "How can I buy 2 cars with only 1 car?" "How can I bake 2 cakes with only 1 cake?" – user253751 Mar 30 '17 at 23:03
  • Why do you think you need to produce a second executable? What is the function of the first one, and what is the function of the second one. – rlam12 Mar 30 '17 at 23:18
  • The first one will only run 1 time and the second one will be a service. First one has a GUI also. And i want to do with this way if its possible rather then leaving a sign when program ran first time and it can be service anymore. – Elliot Mar 30 '17 at 23:20

1 Answers1

1

Use CreateProcess in first executable to create second process from another executaable. https://msdn.microsoft.com/en-us/library/ms682512(v=vs.85).aspx

If you need two output from one project: use post build events:

1- Make a copy of output.

2- Change whatever you want to change.

3- Build same project again: Build another project by prebuild event without adding reference In your case another project is the same project.

Community
  • 1
  • 1
Ali Asadpoor
  • 327
  • 1
  • 13
  • I couldnt tell what i need i think. I want them to be independent from each other. When exe1 ran, it will produce the exe2 which is a project in same solution with exe1. And their contents are different. – Elliot Mar 30 '17 at 23:13
  • Then you just need CreateProcess with the path of second executable. – Ali Asadpoor Mar 30 '17 at 23:14
  • Hmm isnt there any chance that user only will open 1 exe and other one will be created ? – Elliot Mar 30 '17 at 23:15
  • Yes, CreateProcess will do that for you in first executable. You need to pass the path for second executable to this function. – Ali Asadpoor Mar 30 '17 at 23:20