在 Visual Studio 的调试模式下并排启动同一解决方案中的 2 个项目
当我尝试执行我所描述的操作时,出现以下错误:
“无法将文件“obj\x86\Release\AlreadyRunning.exe”复制到“bin\x86\Release\AlreadyRunning.exe”。该进程无法访问该文件' bin\x86\Release\AlreadyRunning.exe',因为它正在被另一个进程使用。”
这是有道理的。我有 2 个 VStudio 并排打开,我在左侧启动服务器应用程序,并想在右侧启动客户端应用程序。两者都在同一个解决方案中,我想同时调试它们。
当然,我可以暂时禁用或更改第二个 VS 中已运行项目的构建输出,但我想知道是否有一种更智能的方法来构建/启动一个项目,而不用担心其余的项目(即不尝试构建服务器项目,该项目已在另一个 VS 实例上运行)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
VS 允许并行调试多个项目...您可以从您想要的任何项目(在您的情况下是服务器)开始,当您准备好时,只需转到该项目(在您的情况下是客户端),右键单击,调试->新实例...
根据上面的评论:
如果这太混乱(因为两者都使用了多个类),您可以随时启动第二个 VS 实例并在启动客户端之后(不是通过 VS 而是手动)将第二个 VS 实例的调试器附加到它
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
如果您正在调试两个不同的项目,您可以通过解决方案属性 -> 来执行它们。启动项目并选择多个。
如果是同一个项目,您可以通过 Visual Studio 启动一个实例,然后手动启动另一个实例(这样您就不必构建两次),然后通过 Debug -> 手动将调试器附加到第二个实例。附加到进程
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