Is there a way to start a project multiple times in Visual Studio? - visual-studio

I would like to simultaneously start multiple instances of a project using Visual Studio. By pressing F5 (Debug -> Start Debugging), at most 1 instance of each project in the solution starts, respectively. I didn't find a way to configure startup of multiple instances of the same project.
The project in question is a console app that is difficult to convert in a way to enable multiple instances within the project.

Well, if you are looking for simultaneously, I don't know.
But you can try right Click on the Project Debug -> Start new instance as many times as you like.

If you don't need to debug you can start multiples instances ("Start Without Debugging")
In case you want to debug an instance you could then attach the debugger to it.
If attaching the debugger is not an option you could use System.Diagnostics.Debugger.Break() method in your code. The equivalent but programmatically.

It's not possible to debug multiple instances of a project using a single project. The IDE/debugger need to synchronize program execution with source code and debugging symbols; it can't do that unless there's only one instance.
You could, however, copy your project multiple times and start them as you describe (as a solution).

Select and Right click any project. Then debug and Start New Instance

Related

Debugging Custom SSIS Task

I'm trying to develop my first custom SSIS task. I've got two instances of SSDT open -- one for building and debugging the task, and the other that uses the custom task. Then in the first instance, I use the Attach to Process function from the Debug menu to debug the code. That all works fine but my trouble is that each time I rebuild the task and register it in the GAC from the first instance, I have to close and reopen the second instance of SSDT. If I don't, the second instance seems to still use the previous build of my custom task. Is there some way besides closing/reopening Data Tools that will cause it to recognize the new build of the custom task? All the closing/reopening is getting exhausting.
While it has been a decade since I last built any custom components for SSIS, the work cycle is as you describe it.
The best bit of of advice I'd offer is to add post-build steps to your development process to GAC the DLL. Oh, and modify your Visual Studio shortcut to include /nosplash to eliminate the startup splash screen.

Eclipse JDT: Debugging in the same IDE instance

I'm writing an Eclipse plugin that needs to specifically make use of Workspace, Projects, Packages, Compilation Units etc.
I already have a decent number of projects, packages, and compilation units in my workspace (not all related to my plugin though, but present nevertheless), which I would like to be able to use as a 'test dataset' for debugging.
When I click the toolbar icon of my plugin, I can print to the console the names of the projects returned by this statement:
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
However, when I launch the debugger, a new Eclipse IDE instance starts up with no projects visible in it anymore. While no project is visible, the projects array does list the project RemoteSystemTempFiles!
But this is completely useless for my debugging needs, as I need some good data set to step through during debugging.
Question: Is there any way to make my projects existing in the development instance of the IDE appear in the second, debugging instance also? Or, if not, can I somehow debug in the same IDE instance instead of starting a second one? I would hate to litter all my code with console-log messages - it's very tedious also to write them in the first place. Setting up the existing test data in the plugin's initialization code would also be way too much work, which I would like to avoid as well.
No you can't run or debug in the same instance. Eclipse will always start a new instance.
You will have to set up the test workspace to contain the data you need to test with.

Debug multiple instances of same project from different instances of Visual Studio

I would like to debug a same C# console project from two different instances of Visual Studio to increase my productivity, as the edit-and-continue mode is not always enough, to say the least.
I have no problem opening the solution twice, and debugging different projects concurrently, but when I try debugging the same project twice, it expectedly fails as it cannot replace the executables in the bin folders.
The possibility to debug twice from the same instance of the IDE as explained here is very welcome, but not good enough for me as I want to be able to completely edit my code when needed.
Is there any simple way to achieve this? Thanks!
Instead of clicking Debug or hitting F5, open a command prompt and start the number of instances you want from there. Now start as few or as many Visual Studio instances you want and go to the debug -> Attach... window.
In the Attach to process window, find the instance youw ant to debug and choose attach. This will allow you to attach to as many instances of your applciation as you'd want.
Now, if you want to be able to edit these application son the fly and spin up new instances, that isn't possible because, as you've found out, the executable will eb in use. Short of creating multuiple copies of your output directory and always starting a copy, never the original, you have no way to achieve that.
Just as a note for whoever stumbles upon this page, as it's ranked very high on Google:
If you want to debug two instances of the same program in Visual Studio, this is as simple as opening up two instances of visual studio and pressing f5 in each instance. This works remarkably well, although you want to wait until one program is up and running before you start the second - otherwise you may get conflicts in your bin folder (which is what it seems OP didn't do.)

Debug single role instance with Azure Compute emulator

I'm building an application which will be run on Azure. My Visual Studio solution contains multiple Azure role projects. When debugging locally, I use the Azure compute emulator.
To start debugging, I follow these steps:
I right-click on my Azure project and click Set as start up project.
I press F5 to start the debugger.
What happens now is that the emulator/vs2010 launches both my web roles and worker roles, even if I'm only interested in debugging a single worker role at the moment. Often when writing some background-processing code in my worker role, I'm interested to step through that code without starting the web role, launch Internet Explorer and so on as well.
Is there a convinient way to make the debugger only launch one of the role instances and not all of them?
I'm thinking of creating a separate project in my solution of type Console Application, where I load the same assemblies as in my worker role and execute the same code.
The emulator (similar to Azure itself) works just on the concept of a "Cloud Service". So when you launch w/ debug, its going to launch whatever is defined in your Cloud Service (.ccproj) project. This mimics Azure 100% which is why it occur, but I can definitely see where your scenario would be helpful.
Few options, based on your needs.
If you need to test azure-specifics (aka it has to run in the emulator)
Create a second solution file, create a new Cloud service in here, add your project. I like this option because the projects/roles themselves remain untouched.
What Stuart suggested before me, create a second Cloud Project, set as startup, run that.
Similar to above, create a second project, but don't worry about startup. You can right click on any project, go to Debug and select start w/ debugging and achieve what F5 does without binding F5 to this solution
If you dont need to test azure-specifics (ie you are just testing the role)
Right click on the role's project, Debug, Start with Debugging This way the whole solution remains intact and you are just testing the logic
I think you can do this by:
create a new Azure Cloud Project within your solution
add just the one worker role to that cloud project
set that cloud project as your startup project
This will single out just the worker you are interested in
An easier solution would be to open the ServiceConfiguration.cscfg file, and set the "Instances > Count" property to "0", for all the roles that you don't want running (this only works in the compute-emulator, and NOT on the azure cloud).
That way, you keep your solution intact and your configurations safe, while just omitting them from the compute-emulator during run-time.

Visual Studio locking files while debugging

I have a VS solution containing several projects. While debugging a particular project all the source files are locked by VS. I would like to unlock sources that the debugee doesn't have dependency on. Is there any way to do this within one solution?
UPDATE:
I'm using Win XP SP3 32bit. Visual Studio 2010, C#. Edit and Continue is enabled. The solution contains 6 projects (number in not important actually), 5 of them depend on the data access layer project which uses Entity Framework. None of the 5 have any mutual dependencies. They are WinForms and Console applications. I would like to be able to run one of the projects and make changes to others without stopping the first. The problem is starting and stopping the project take considerable amount of time.
The Edit and Continue feature is preventing you from editing files if the debugger hasn't stopped the program. The simple workaround is Debug + Break All, you should then be able to edit the files, your changes will be immediately effective provided your changes do not violate the restrictions imposed by E+C. This is the most efficient work flow.
The heavy-handed approach is to disable Edit and Continue. Tools + Options, Debugger, Edit and Continue, uncheck the Enable check box.
I don't think that there is a way to avoid that. While debugging Visual Studio lock all files to prevent any change on them, including those on other projects.
You can try to open the project which you are interested on with another Visual Studio instance to make changes to your files or open files singularly with another editor.
This doesn't quite answer the OP's question per se, but for anyone who has stumbled upon this page in the same (very frustrated) boat as I am, this might help.
The solution: start without debugging.
It was driving me absolutely crazy that Visual Studio would not let me edit files while the app was running. My typical workflow is:
Make some changes
Run the app to see the effects of those changes
Based on the results, make more changes, etc. etc.
The problem is Visual Studio was preventing me from step 3. It demands that you STOP running the app before you can even make any changes (including to a XAML file or adding a file to the project), which also means that you can't go back to the app to double-check something while you are actually programming it at the same time (which is how I work, bro).
Thank god I finally discovered if I run without debugging it doesn't impose this ridiculous limitation. It's still a pain in the butt if you actually need to debug something you have to re-run the app in debug mode, but it sure beats having to kill the app before it will even let you edit a file.

Resources