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.

link|improve this question

71% accept rate
1  
As for your search questions see stackoverflow.com/search superuser.com/search 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
feedback

2 Answers

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.

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

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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