本文介绍了在Visual Studio中单击运行多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我是否可以通过简单点击或设置一个密钥来运行我的应用程序的多个实例(现在2个实例)。
THanks ..

I wonder if I can run multiple instances (right now 2 instances) of my application in debug mode by doing a simple click or set a key for that..THanks..

推荐答案

没有多少人似乎知道这一点,但这是完全可能的,虽然我承认这不是很明显。
这是你所做的:

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:\bin\my在A的解决方案中添加一个空项目,将其称为Dummy

  • 在Dummy的项目中,将属性 - >调试将命令设置为指向c:\bin\my.exe

  • 解决方案属性 - >配置管理器 ,取消选中所有Dummy项目的构建,以便VS不会尝试构建它(构建一个空项目失败)

  • 在解决方案属性 - >启动项目下,选择多个启动项目,并将A和Dummy的操作设置为

  • 现在点击F5并且您的exe将被启动两次,每个都在单独的调试实例下。 (您可以在 Debug-> View-> Processes 窗口中看到)

  • suppose your current project is A, and it's output is c:\bin\my.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:\bin\my.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中单击运行多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:41