1

Im working on creating a feature in a website, where people cah write C# code in the input box , and it can be compiled and results emitted.

Any resources or suggestions as to how to start with this.

Justin ᚅᚔᚈᚄᚒᚔ
  • 15,081
  • 7
  • 52
  • 64
Sundararajan S
  • 1,358
  • 2
  • 14
  • 24
  • check out [this](http://stackoverflow.com/questions/5161708/online-c-interpreter-security-issues/6319291#6319291) thread. – ren Jul 08 '11 at 23:00
  • possible duplicate of [Compiling/Executing a C# Source File in Command Prompt](http://stackoverflow.com/questions/553143/compiling-executing-a-c-sharp-source-file-in-command-prompt) – nawfal Jul 22 '14 at 16:50

3 Answers3

2

The .Net framework has built in runtime compilers. They are in the System.CodeDom.Compiler namespace.

The other thing to consider is when you are compiling the code what assemblies you link in. If you link in an assembly the code you compile will have full access to that assembly and it will be compiled and running on your server.

Digital Powers
  • 460
  • 6
  • 23
  • Any specific implementations? How do everyone implement all types of languages? – Sundararajan S Jul 01 '11 at 18:24
  • I am not sure what people use for different languages, the .net codedom compiler can handle javascript, boo, ironpython, c#, vb.net ect but I dont know if it can handle any others. And I know that boo and ironpython at least take some additional work to get them running. – Digital Powers Jul 01 '11 at 19:48
0

I'm using Microsoft.Build and Microsoft.Build.Framework in my online .Net IDE, Chpokk. Soon, Roslyn will be the way to go (I'm currently using it for Intellisense).

ulu
  • 5,872
  • 4
  • 42
  • 51
0

Code compiled should be done in a sandbox. You can interface with the compiler through the command line.

http://msdn.microsoft.com/en-us/library/1700bbwd(v=vs.71).aspx

Nathan Romano
  • 7,016
  • 3
  • 19
  • 18