Visual Studio Compile standalone C# file

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.

0fnt

Posted 2010-06-23T15:31:40.027

Reputation: 1 741

1

As for your search questions see http://stackoverflow.com/search http://superuser.com/search and Stack Overflow Search – Now 61% Less Crappy

– heavyd – 2010-06-23T16:34:36.413

I think visual 6 was the last to let you do this – Nick – 2010-07-31T18:48:51.420

Answers

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.

Rowland Shaw

Posted 2010-06-23T15:31:40.027

Reputation: 3 607

Thats sad. I don't like that folder structure etc, but okay, will have to do it. Thanks. – 0fnt – 2010-06-23T18:46:52.923

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

Goyuix

Posted 2010-06-23T15:31:40.027

Reputation: 6 021