Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a c# file, I opened it in VS2010, and I want to compile it now. Is it possible? I know I can compile it using C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe, but I do not want this. I want to know if I can compile a standalone C# file from VS2010. Thanks.

PS I strongly think that the stackoverflow/superuser search needs to be improved a lot. I hardly seem to be able to find questions. Something tells me that this is the kind of question that must have been asked before, but I can't find out.

share|improve this question
As for your search questions see and Stack Overflow Search – Now 61% Less Crappy – heavyd Jun 23 '10 at 16:34
I think visual 6 was the last to let you do this – Nick Jul 31 '10 at 18:48
up vote 5 down vote accepted

Visual Studio is orientated around projects, so you'd need to add your cs file to a new (empty) project, before you can compile it through Visual Studio.

share|improve this answer
Thats sad. I don't like that folder structure etc, but okay, will have to do it. Thanks. – 0fnt Jun 23 '10 at 18:46

While this really doesn't answer your question, may I recommend taking a look at LINQPad? It does so much more than just execute LINQ - I use it to rapidly test/demo code as I can compile it immediately and see the results. The work the author did with the .Dump() extension method is super helpful as well.

enter image description here

share|improve this answer

Your Answer


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.