Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How to add 2 project together for compile and make as one.

Posted on 2006-07-10
Medium Priority
Last Modified: 2013-11-20
Under the same workspace, there are 2 projects A and B. Currently, we compile A and B separately. Run A first, A dumps its result to a file in hard disk. Then, run B and B get input from a file from hard disk(this file is either the one porject A created or from somewhere else.)
Now, want to compile and run these 2 projects together following any of the following sequences.
1. Compile A & B together, then automatically run A, then B (A created a file in hard disk and B get input from the file A created)
2. Compile A & B together, then run B only (input from a file with known file name from hard disk).
A command line parameter is used to choose any of the above 2 running sequences.
Do I need to merge the 2 projects together? (it is very big, a lot of files involved, there are a lot of variables to be renamed since the same names appear in both projects,will cost a lot of time)
Any easy way?
Question by:turbot_yu
  • 3
  • 2
LVL 45

Assisted Solution

AndyAinscow earned 1400 total points
ID: 17072581
Keep them as separate projects and create batch files to do the processing that you require.

Author Comment

ID: 17072729
how to set the parameter of the batch file?
LVL 45

Accepted Solution

AndyAinscow earned 1400 total points
ID: 17072797
eg. batch file - RunB.bat

x:\SomePath\Release\B.exe "PathToFile.txt"

To compile a project - CompileB.bat

devenv x:\SomePath\B.sln /build "Release"
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 17073412
how to detect whether the txt file is ready in batch file.
LVL 22

Assisted Solution

mahesh1402 earned 600 total points
ID: 17075038
you may also write small program code to perform this 'Automation'..if you need to programatically detect if text file is ready or not....

You may use SHellExecute() / CreateProcess() for your purpose to execute command lever compiler options..

1) Compile and execute 'A' with ShellExecute()

2) wait in loop for creation of text file ( e.g by detecting if file is ready to open in read mode..)

3) Compile and Run B by taking input from generated text file.

You may refer samples how to use ShellExecute :


LVL 45

Assisted Solution

AndyAinscow earned 1400 total points
ID: 17076370
<how to detect whether the txt file is ready in batch file.>

When 'A' finishes writing the text file then it could start 'B' (eg. by CreateProcess) - no need for another app in that case.

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question