Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
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
add comment

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.

share|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
add comment

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
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.