Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

An application has the following logic:

  • client => created *.cpp => sent to the server => cl.exe + *.cpp =
    *.exe
  • client => created *.cs => sent to the server => csc.exe + *.cs =
    *.exe
  • client => created *.pas => sent to the server => PascalCompiler +
    *.pas = *.exe
  • etc.

The language - C#. I hear that MSBUILD can help me, but I don't understand how to change compiler on server at runtime. Does anyone know of options other than Process class?

I'm trying to write an online system to test programs in programming contests. The programmer selects the compiler and sends the source code to the server for verification.

And I do not need to build the project, I just need to compile a single file.

share|improve this question
5  
You've already asked this question twice on Stack Overflow, and it is still not really answerable. What are you trying to do? A build system? A custom application in C# to do this? –  Mat Jul 29 '12 at 8:34
add comment

3 Answers

It sounds like you are trying to automate a build process? A few more details of what you want to achieve would help.

MsBuild is Microsoft's build tool, not sure if it will help you with Pascal. Other tools that will include NAnt.

Have a look at Continuous integration, and CC.Net (CruiseControl.Net) There are other tools as well.

I'm sort of guessing what you want a bit, so please add a few more details.

share|improve this answer
1  
I'm trying to write an online system to test programs in programming contests. The programmer selects the compiler and sends the source code to the server for verification. –  mif Jul 30 '12 at 8:16
1  
And I do not need to build the project, I just need to compile a single file. –  mif Jul 30 '12 at 8:24
add comment

If all you have to compile is a single file, then why not simply require developers to adhere to a file suffix standard and drive the compiler choice from the file type? Just iterate through the directory, picking up every file in it and checking its suffix. If it's a "known" suffix, then fire off the appropriate compile command in a separate thread. When your loop ends, wait on all the children before scanning again. You'll need some way to move or flag files once they've been processed and a notification mechanism to inform the submitters whether their compile failed or not, but those are fairly trivial details.

share|improve this answer
    
When the program is checked suffix, HOW to run the right compiler. –  mif Jul 30 '12 at 21:34
    
I assume you'll have a mapping like .cs => csc /out:{0}.exe [0].cs. So when you find a .cs file you retrieve the mapping, format the value using the base file name, then run the resulting command in a separate process (like this). –  TMN Jul 31 '12 at 12:34
add comment

You are on a right track.

I would suggest to start with your MSBuild and continues integration process. Dealing with continues integration takes time and resource. I would advice to think twice on the goal that you are planning to achieve.

I have compiled a list of good resources that hopefully will help you to understand the build process itself:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.