user2917063
user2917063

Reputation: 33

Visual studio showing same output when run a different program

Im newbie, in visual studio 2012 i have 2 tabs of different program when i try to run second program it gives output of first program, for example one program has outputs "hello world" and second program has output "hello cat", when i run program of hello cat it gives hello world, why is this happens? how can i solve this problem?

Upvotes: 2

Views: 4353

Answers (3)

Sudhakar Tillapudi
Sudhakar Tillapudi

Reputation: 26209

Problem : you are running the same project/program always.

Solution 1:

Select the project you want to run.
Right click on it.
Select Debug Option
Select Start new instance.

Solution 2:

Select the project you want to run.
Right Click on it.
Select Set as startup project.
Now run the project.

EDIT: when you right click on the Project( not on Solution) you will get following ContextMenu from there you can find above mentioned options to proceed further.

Project ContextMenu

enter image description here

Upvotes: 1

JaredPar
JaredPar

Reputation: 754893

Note that you don't have 2 different programs open in the tabs but instead 2 different files each one belonging to a different project. When you hit run / F5 Visual Studio doesn't decide what to run based on the selected file. Instead it will attempt to run the project which is currently labeled as the start up project. Hence simply changing the active tab won't have any effect on what is run.

If you want to change the project which is being run then right click on the target project and select "Set as Startup Project". The project which is currently the startup project will be displayed in bolt text

Upvotes: 1

dburner
dburner

Reputation: 1007

Right click on the project that outputs "hello cat" and click "Set as StartUp Project".

In Visual Studio a solution may hold none or many runable applications. The project with the bolded text is the project that will run when you click "Start".

Upvotes: 4

Related Questions