Hi Everyone,
I need to make a small utility in C# which can bind two exe files to one output exe file.
by executing one output exe file but exe's should run simultaneously/
1) Is it possible to make such type of utility in C#??
2) is any helping tutorial available which can give me some idea??
Thanks
AlanPosted Sep 10, 2007, 12:43 PM
Well, unless you buy an expensive third-party linker, the .NET framework needs to be installed on your machine to run any C# application.
However, I'm not entirely clear what you're trying to do here. If the applications are still in source code form, then you can compile them into a single .exe at runtime by using the Process class to call the C# command line compiler, csc.exe. The only point to note is that only one of the source code files should contain an entry-point (i.e. a Main() method).
If the applications have already been compiled, then it's possible to merge them into a single assembly using a Microsoft utility called, ILMerge, which can be freely downloaded from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=22914587-B4AD-4EAE-87CF-B14AE6A939B0&displaylang=en
Although this utility would normally be run directly from the command line, it should be possible to use the Process class to run it from a C# application.
SachPosted Sep 10, 2007, 11:57 AM
Cool way but this way i can give only path of the exe and those exe's need to exist.
but what i want to do is to make only one exe and delete the other two source exe's
one more doubt if i create an exe using this method i would be needing framework on the system ??
AlanPosted Sep 10, 2007, 7:58 AM
It's the System.Diagnostics.Process class that you need for this:
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx
If the two exe's don't have any special requirements or need any command line arguments, then the code for output.exe could be as simple as this:
using System;
using System.Diagnostics;
class Program
{
static void Main()
{
Process.Start("exePath1");
Process.Start("exePath2");
}
}