I have two web applications in the same solution. I put break points in both of them and when debug I can't access but the start up one. How to debug both of them?
Just right click on your project solution in visual studio then go to properties and in Common Properties > Startup Project select Multiple startup projects. Then choose the appropriate action.
That way you will be able to debug both
You can have only one active project at time of compilation/running. By the way, if one active project somehow calls something from another, just press F11 and you will jump into another project and symbols for it will be loaded automatically and you can debug it.
EDIT
If you are asking about debugging 2 projects contemporary in parallel, it's not possible with in one VS. If these are the separate projects that communicate with eash others, let's say chat application, you can naturally, by running two instances of VS and debug communication between them.
Hope this helps.
You should try to open two versions of visual studio, run both solutions, but set the start up project differently for each, and run them both. The two instances of visual studio should catch the break points of their respective start up programs. I know this works for windows/console applications. Although I've never tried it with 2 web applications. You may have to configure the applications to use different ports.
Related
I have a solution mainly written in c sharp. This solution has 10 projects, one of them contains the web forms. This web forms get the data from another project. However, I am receiving null data. In order to debug this, I would like to setup the web forms project as the start project but the problem that I'm getting is that I don't see what is going on on the other project, the one that passes the data. How can I reach this project when debugging? Any solutions? The other project just contains classes, it is not dealing with the database either yet.
Thanks
Have you tried to set the solution to start multiple projects at once?
Right click on "Solution Explorer", click on "Properties", select "Multiple startup projects" and choose what projects you want to start together by changing the dropdow from "none" to "start". It should work.
sorted! it was a silly mistake, the interface was misspelled, it should be IClass, being Class the class name, somehow, it was misspelled
This question ...and the answer shows how to start another instance of a console app in Visual Studio when you already have one running.
I want to do the same BUT passing different args[]. For example, when debugging I want to start up 2 instances of MyConsoleApp.exe as follows...
"MyConsoleApp.exe Agent1"
"MyConsoleApp.exe Agent2"
Does anyone know how to do this?
(Using Visual Studio 2015 Pro)
As far as I know you can't. What I'd do is open the solution in two VS instances and run it. Or else you can give it a go the following way too ( haven't tried this but ideally it should work)
Create two console projects and add all your files as 'linked' files on both projects ( the same .cs files being used on both projects)
Go to the solution and set one project as 'Start with Debugging' and other as start without debugging. ( or may be both as Start with Debugging- depending on your scenario) here is how you could do this.
I have a Visual studio solution containing multiple programs, each of which contains it's own Class and Main Method. I need to set these programs up to run one after the other, as some of them access the same database tables, and I do not want there to be conflicts.
I have tried setting up dependencies and creating a new program with class dependencies, however, this does not seem to have worked, does anyone have an idea?
Right click on your solution > Properties > Common Properties > Startup project
Select "Multiple startup Projects" and change the value of the Action column from "None" to "Start" or "Start without debugging"
Visual Studio is a development tool. It is not a tool to orchestrate how your application should execute. Your application should also function when executed outside Visual Studio.
With that in mind you need to decide how to partition your application. Right now you seem to have several applications (console programs?) that need to execute one after the other. An easy solution is to create a batch file that executes each in turn. You can also create a separate application that execute each "child" application in sequence using the Process.Start method but why bother when you can create a batch file?
You might also consider merging your different applications into a single application that has a Main method that executes each task in sequence.
Without more information about your problem it is hard to give you specific advice.
You mentioned you have tried "Multiple Startup Projects" approach but did you set the order in which multiple projects run when you start the debugger?
To set the order in which multiple projects run when you start the debugger
Open the Solution Property Pages dialog box.
Select the Startup Project set under Common Properties.
In the pane on the right, select Multiple Startup Project.
Select a project, and then click Move Up to run that project earlier when you start the debugger, or click Move Down to run the project later.
Reference: How to: Modify Project Properties and Configuration Settings
You need run each program in separate Visual Studio instances.
Is it possible to debug multiple projects at the same time in Visual Studio?
I know you can select multiple startup projects from the solutions properties, but how are the breakpoints handled?
If two projects use the same class (two different instances of it), and I am stopped with a breakpoint in it, will it only block one program or both? How can I know which executable is hitting the breakpoint? I'm a bit confused.
Yes, it is possible. You can set multiple startup projects in your solution (right-click solution, go to Set Startup Projects, choose Multiple startup projects), and specify the action for each project contained in the solution (None, Start, Start without debugging). If you have multiple projects set to Start, the debugger will attach to each one as it launches.
When you hit a breakpoint, you can see which process you're in using the Debug Location toolbar (you may have to show it; some profiles hide this by default). It will show which process you're currently looking at, which thread you're on, and which stack frame you're in:
I believe the default behavior is that when one process breaks, the debugger will break all of them. This way you can check the state of any attached process when you hit a single breakpoint.
No. You can debug an EXE file and step into a debug version of a linked DLL file, if you're careful about making sure the EXE file "sees" the same DLL file as the debugger, but you can't debug two EXE files at the same time. At least as far as I'm aware.
I have a lobby application which invokes a client-application (think: League of Legends). They're two separate applications and the first invokes the second from itself - how can I get Visual Studio to debug this application as well?
You simply need to launch a separate Visual Studio, and then use Debug | Attach to Process to attach to the other process. The trick is using two Visual Studios.
Debug -> Attach to process
Select the executable from the list.
Make sure to select the right code type with the Select.. button.
Have you tried Debug -> Attach to Process?
Ref: http://msdn.microsoft.com/en-gb/library/vstudio/3s68z0b3.aspx
Like Matthew said Debug|Attach to process. If the other application is in a different service you might also want to look into remote debugging
The other answers are correct, but I just wanted to add another approach:
If you add both projects to a single Visual Studio Solution, you could:
Right-click the solution -> Properties -> Common Properties -> Startup Project
There you would select Multiple startup projects and select both the Lobby and the Client applications.
That way you can debug several VS projects without having to run several VS instances.