Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch 2 Projects from same Solution Side by Side in Debug Mode in Visual Studio

When I try to do what I describe I get the following error :

"Unable to copy file "obj\x86\Release\AlreadyRunning.exe" to "bin\x86\Release\AlreadyRunning.exe". The process cannot access the file 'bin\x86\Release\AlreadyRunning.exe' because it is being used by another process."

Which makes sense. I have 2 VStudio open side by side, I launch server App in the left one, and want to launch Client App in the right one. Both are in the same solution and I want to debug them simultaneously.

Of course I could disable or change the build output temporarily for the already Running project in the second VS but I was wondering if there was a smarter way to build/launch only one single project without bothering about the rest (i.e without trying to build the server project, which is already running on the other VS instance).

like image 977
Mehdi LAMRANI Avatar asked Mar 07 '26 12:03

Mehdi LAMRANI


2 Answers

VS allows to debug several projects side-by-side... you can start with any project you want (in your case the Server) and when you are ready just go to the project (in youtr case the Client), right-click, Debug->New Instance...

As per comments above:

If that is too confusing (because of several classes being used by both) you can always start a second VS instance and AFTER starting the Client (not via VS but manually) attach the debugger of the second VS instance to it

like image 72
Yahia Avatar answered Mar 10 '26 03:03

Yahia


If you are debugging two different projects you can execute them both trough Solution Properties -> Startup Project and select multiple.

If it's the same project, you can launch one instance trough Visual Studio and the other one by hand (so you don't have to build twice) and attach the debugger manually to the second instance trough Debug -> Attach to process

like image 31
Wouter de Kort Avatar answered Mar 10 '26 01:03

Wouter de Kort