user2602079
user2602079

Reputation: 1393

Run a .cs file - visual studio 2012

Hi im starting to learn c# just now with visual studio 2012 and windows 8, and the tutorial has given some .cs files and not explained how to run them. It is all command line stuff in this tutorial. This stack overflow answer gave the most easy-sounding way of doing it (in response to a similar question by someone else).

If you already installed Visual Studio, just: Click Start, point to All Programs, point to Microsoft Visual Studio, point to Visual Studio Tools, and then click Visual Studio Command Prompt and there you have your command line box where you compile as follows:

csc PathToYourCsSource

I cannot find visual studio tools. I typed it into the search in windows 8. Thanks

Upvotes: 2

Views: 30179

Answers (4)

Suyash Kumar Singh
Suyash Kumar Singh

Reputation: 173

1.

in visual studio directory go to Common7>Tools>Shortcuts>Developer Command Prompt for VS2013 run this ,type csc programName.csc for compiling and programName for run

Make sure to change the directory of console to your program path

2.

In visual studio create new C# console application and write there ,for run go to menu debug>Start Debugging

Upvotes: 0

Cubicle.Jockey
Cubicle.Jockey

Reputation: 3328

You can also use tools like Linqpad to run snippets of code so you don't have to use the bloat of an entire Visual Studio solution/project.

Upvotes: 0

Tim S.
Tim S.

Reputation: 56536

"Visual Studio Tools" is the name of the folder in the All Programs list, not the name of an item you can find by searching. You can search for "Developer Command Prompt for VS2012" (or some portion of that) instead.

I'd recommend that instead, you work with your .cs file as part of a project in Visual Studio. It's easy to create and run a Console Application from the IDE.

Upvotes: 1

Smarties89
Smarties89

Reputation: 561

It is easier to: Run Visual studio -> Make a new C# console project.

This makes a project with a simple Program.cs file. You can just copy/paste in that, and run the project my clicking F5.

Upvotes: 6

Related Questions