Please bear with my English, I'm a 14 year old guy from Sweden.
I just started learning C# a few days ago, so I wanted to create something simple (but yet still useful).
I'm making a console application which launches the compilers for different programming languages. So far have I got compilers for Java, C/C++, C# and Pascal. This is how the program works:
1. The user types in the path to the file (s)he wants to compile.
2. The user selects which language the program is written in using numbers.
3. The user decides whether (s)he wants to compile the file or not. This is only to confirm the compiling, so everything doesn't happen too fast, if you understand what I mean.
4. When the user have typed "yes" and pressed Enter, the program uses a void called Compile() to launch the right compiler for each language.
^ This is where the problem appears.
I work using Visual C# 2008 Express Edition. When I save my project, Visual C# automatically generates a folder called whatever the project is called (in this case, FayconCMD). It generates a folder called Release, where the final program is (FayconCMD.exe).
I've copied the C# compiler from .NET v3.5 into this folder. In the program, the "path" to the compiler is only written "csc.exe", because they are in the same folder. But when I try to compile a test file written in C#, I get the error that the program can't find csc.exe. Do you know why this happens?
I also want to launch csc.exe with an argument, the path to file that shall be compiled. How do I add that? If you had compiled the program manually using cmd.exe, you've done this:
1. Changed the directory to where the file is.
(cd <path to the folder where the file to be compiled is>)
2. Typed csc <file name> (assuming you've added the folder where csc is to your environment variables).
Now I want to just launch the csc.exe with the path to the file as an argument, using this method:
Expand|Select|Wrap|Line Numbers
- public void Compile()
- {
- System.Diagnostics.Process.Start(pathToCompiler + " " + Path);
- }
1. Why can't my program find an .exe-file in the same folder?
2. How do I execute csc.exe with an argument?
Sincerely yours,
Saser