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:
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)
You can use "Multiple Startup Projects" feature, but avoid creating dummy projects by hand: just add your debuggee executable into the solution directly:
Solution > Add existing project > Path to .exe
If you neeed several instances, Visual Studio won't allow you to add the same executable twice, but adding a symlink to it with another name works as expected.
MSDN: How to: Debug an Executable Not Part of a Visual Studio Solution
Is Visual Studio 2013 this is even easier!
Project-> Properties -> Debug -> check "Start external program" and click the ... button, navigate to your .exe of the other program.
Then Make sure in your Solution -> Properties -> MultipleStartup Projects that it's checked.
You can run two instances of your application from where it is built; example: d:\test\bin\debug\app.exe and attach both instances to the Visual Studio 2010 debugger.
Related
I was a CLION user for long, and until recently I switched to visual studio 2017 since CLION uses too much memory.
In CLION, basically I can cmake the whole project with the top-level cmake file and generates multiple targets to select from a drop-down button.
I did the same in visual studio except in visual studio I need to run the cmake first to generate a .sln file and open it in visual studio.
After open this, I can see different class instances(my targets) in the solution explorer, but I do not know where to specify which target to run. Each of my target has its own main function. Also, I have integrates all my targets into a top level object called BUILD_ALL. I can build this build_all which builds all of my individual target. But still i dont know how to run each one.
I tried by using the right-click and start a new instance, but it rebuilds the target everytime which is not wanted. In Clion, this is not a problem.
Could someone help on this?
Thanks in advance.
I would suggest using the Set as Startup Project option. This will make it so the build and debug shortcuts target the selected project.
Right click on the project in the solution explorer and choose Set as Startup Project
Another option is to just build and or debug the project directly from the right click context menu.
Depending on how much you work with CMake and Visual Studio you may want to look into VS_STARTUP_PROJECT
I have a big solution and for debugging purposes I have to start many Projects by using "Set StartUp Projects" Feature of Visual Studio 2012. However often I need to change what projects I need to start (Sometimes is Project A,B,C, sometimes Project B,C,D etc.)
Does someone knows such an Extension?
Take a look at the SwitchStartupProject extension. (I'm the author)
Since version 2.0, it allows you to configure multiple multi-project startup configurations. You can switch between the configurations with a toolbar dropdown box:
To configure two configurations (A, B, C) and (B, C, D):
Install the extension (you might need to restart VS)
A new Startup Project dropdown box appears to the right of the Start button.
Click on it and choose Configure...
Select single-project list mode None (to hide the single project items from the dropdown)
Add two configurations and name them ABC and BCD
Add multiple projects to each of the configurations
Choose the order in which the projects will be started
Note: Unlike the Visual Studio startup projects dialog, the extension does not allow you to choose start without debugging for a project. So all projects that you add to a multi-project startup configuration are started with debugging.
I've got a Visual Studio 2010 solution that I would like to add a project to that only contains some command-line scripts. This project isn't meant to actually compile/build anything, but I want to be able to edit my scripts with the rest of the solution, and have TFS integration etc.
Unfortunately, in searching I get a lot of results for errors where builds don't happen, or other conditions where specific build targets are implemented. I simply want a non-build project in VS as a visual repository for the editor. I don't want to one-by-one include individual files in a solution folder.
In the build configuration manager (On the Menu, "Build", "Configuration Manager"), there is a "build" checkbox for each project. Uncheck it for your script project.
Could you make a content project, add your scripts to it, then change their properties to "Do not compile"?
My IDE is Visual Studio 2010. I have a solution (.sln) containing more than 100 Projects (.vcproj). The language is C++. The solution has two configurations: "Release" and "Debug". The solution has two Platforms "Win32" and "x64". I need to create a third configuration, let's call it "Release_and_PDB". "Release_and_PDB" should be equal to "Release" except in that it should generate the PDB files. In the future "Release_and_PDB" should be always equal to "Release" except in that it should generate the PDB files. I think I can do it in three steps:
Create a new Configuration.
Manually change every project property adding the path and name for the PDB (in Linker, Debugging, Generate Program Database file).
Ensure that a property change in the Release will also reflect the same change to the Release_and_PDB configuration
My questions:
a. Does Visual Studio have any facilities to get the step 2 done without the need of manually changing the properties of any (and every) project?
b. Does Visual Studio have any facilities for the inheritance of project properties to get step 3 done without the need to also manually change the property in Release_and_PDB?
You go to configurations manager in the toolbar -> new -> copy settings from.
I think that's what you're looking for.
I created a solution in Visual C# 2010 Express that contains two projects: one is the client, the other is the server. I would like to debug both at the same time, but I can only seem to run one of the projects during debugging.
Is there a way to run both at once?
Go to Solution properties → Common Properties → Startup Project and select Multiple startup projects.
Max has the best solution for when you always want to start both projects, but you can also right click a project and choose menu Debug → Start New Instance.
This is an option when you only occasionally need to start the second project or when you need to delay the start of the second project (maybe the server needs to get up and running before the client tries to connect, or something).