how to compile/debug from within VS

R

Robert Blackwell

I want to be able to compile/debug from within VS. Currently, I'm just
making a bunch of little console apps from book examples and so I've been
typing them out, and compiling/running from the cmd prompt. I know it sounds
kind of lazy but it would be nice to just be able to push F5 or ctrl+F5 and
have it do it for me.

I tried making a new solution, and then I placed all my files within the
solution folder, but none of the files appeared in the solution explorer.

Also none of these files will call from any others. And I noticed that if I
made a new solution, made a file compiled it works just fine, but then, when
I make a new file and try compiling it comes up with errors because all my
files use static void Main() is there a way to just compile one file instead
of the whole solution or am I just stuck to doing it the way I have been?

Thanks
 
M

Morten Wennevik

Placing the files in the solution folder won't do anything, you have to
tell the solution to add new project/files. Chose File->Add Project-
Existing Project and then browse to your individual project files (.csproj
files). You can also right click your solution name and Add->Existing
Items to add individual files in case you don't have a project.

I'm not quite sure what you are trying to do. You can put a whole bunch
projects in a single solution, but if you got more than one static void
Main() in the solution you won't be able to run it with F5/Ctrl-F5. You
can however compile a single project by right clicking the project name in
the solution explorer and choose Build.

If you have a bunch of files with static void Main() in several, comment
out the ones you don't want to run. F5/Ctrl-F5 will then work just fine
and will Compile, then run.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top