在 Visual Studio 中一键运行多个实例 [英] Run multiple instances with one click in Visual Studio
本文介绍了在 Visual Studio 中一键运行多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道我是否可以通过简单的单击或为此设置一个键来在调试模式下运行我的应用程序的多个实例(现在是两个实例)...
I wonder if I can run multiple instances (right now two instances) of my application in debug mode by doing a simple click or set a key for that...
推荐答案
似乎没有多少人知道这一点,但这是完全可能的,尽管我承认这不是很明显.您可以这样做:
Not many people seem to know this, but this is perfectly possible, though I admit it's not very obvious. Here's what you do:
- 假设你当前的项目是A,它的输出是c:inmy.exe
- 在 A 的解决方案中添加一个空项目,将其命名为Dummy"
- 在 Dummy 的项目 Properties->Debugging 下设置 Command 指向 c:inmy.exe
- 在解决方案属性->配置管理器下,取消选中虚拟项目的所有构建,这样 VS 就不会尝试构建它(构建空项目失败)
- 在Solution Properties->Startup Project下,选择Multiple Startup Projects并将A和Dummy的Action设置为Start
- 现在按 F5,您的 exe 将启动两次,每个都在一个单独的调试实例下.(正如您将能够在 Debug->View->Processes 窗口中看到的那样)
- suppose your current project is A, and it's output is c:inmy.exe
- add an empty project to the solution for A, call it 'Dummy'
- under Dummy's Project Properties->Debugging set the Command to point c:inmy.exe
- under Solution Properties->Configuration Manager, uncheck all builds of the Dummy project so VS won't try to build it (building an empty project fails)
- under Solution Properties->Startup Project, select Multiple Startup Projects and set the Action for both A and Dummy to Start
- now hit F5 and your exe will be launched twice, each under a seperate debugging instance. (as you will be able to see in the Debug->View->Processes window)
这篇关于在 Visual Studio 中一键运行多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文