1

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.

2

2 Answers 2

6

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.

1
  • Thats sad. I don't like that folder structure etc, but okay, will have to do it. Thanks.
    – 0fnt
    Jun 23, 2010 at 18:46
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .