Debug Multiple Microservices in Visual Studio - visual-studio

I have a solution which contains two microservices and an API gateway. While debugging, the solution requires to run again and again to get insights or fix bugs.
I have tried dotnet watch run but with this I can attach debugger to one project at a time.
Hosting applications on IIS also requires to copy the files to folder every time for small changes as compared to in .NET Framework where it was easier to host applications on localhost and attach to process.
Currently, I have been debugging it using visual studio with multiple startup projects.
Since pressing F5 constantly is repetitive and hectic so is there any other way around to debug multiple projects using dotnet watch or IIS or anything else?

ctrl+F5 can run multiple, but it will not debug. Other solution try run multiple VS studio, but I'm not sure

There is possibly another way. I was also had issues running multiple projects to debug microservices.
I explored a few possibilities:
Docker - didn't help and ate more memory (if our whole stack was .net core this might be the goto)
Auto starting VS projects with a script (better but not quiet the level of control we needed)
Researched all the things that people said (use logging, do tests etc, all of which ignore the fact that we don't all have perfect codebases to work in)
Finally I created something that works well for our team, and maybe it'd work for you?
Dev Launcher is a simple command line utility that you configure with your project information. It's currently aimed at handling .net full framework, runs in (Visual Studio) and .net core runs with (Visual Studio or dotnet run). It is configurable and I'm guessing a person could get it to work with other IDE's such as VS Code, though I haven't tried it.
The main concept is you first choose the projects you'd like to open for debugging. These projects will open in the IDE which is configured (Defaults to Visual Studio). Then you choose the supporting microservices that you'd like to run in the background. If these are written in .net core they will run in a console window, freeing the memory that would normally be consumed by the IDE and debugger.
Curious to see if that'd be helpful for your situation. Also curious what other ideas people have to make debugging multiple microservices better...

Related

Multiple projects: symbols seem to be unloaded

I have a WebApi project, and an MVC project that consumes the WebApi project through RESTful calls.
I set my VS 2013 Professional system to start both projects at the same time.
If I run either project alone, I can set and capture breakpoints. If I run both projects, only breakpoints in the WebApi project are available. How do I fix this? As far as I can tell, there are no version issues with any common assemblies, and the multitude of answers on SO do not seem to apply.
So apparently the answer is shouting curse words at your monitor. After restarting IIS Express, Visual Studio, and my machine multiple times, Cleaning the solution multiple times, changing the build config back and forth multiple times, it just started working all of a sudden. No code or configuration changes. Whoever said insanity is doing the same thing repeatedly and expecting a different result was clearly not a developer. Either that or I'm insane. (could be both)

Test Project in Visual Studio 2010 for a Windows Service Project

I am working now in a Windows Service Project and I am having a lot of headaches trying to debug the service, I found a lot of article on how to debug a service but none of them worked for me :(
How to: Debug Windows Service Applications
There is no way after attach the process to enter in my breakpoints (set breakpoints everywhere)
Then I found another creating a windows form inside the project but that Solution is kind of dirty (but a solution).Testing a Windows Service From Within Visual Studio
So the real question is, is there any possible way to create a test project to test the service? (I don't have experience with testing, but I know is a good practice)
Do you want to debug the service or code that service runs?
In the past I would create one project for a service, one project for a library that contains the logic, and one project for a console app that would be used to test and debug the logic locally. That setup covered most of the debugging needs.
Hope this helps!

Is it possible to edit files in one project while running another project in the same solution in VS2010?

Almost all of our Windows projects consist of a WCF windows hosted service and then a WPF client application. All of these have usually been split into two different solutions, one for the service, one for the client. This was done for various reasons, but we recently were looking at possibly putting them all together on a new project, which we did. This would mean not having to run two copies of Visual Studio and make it easier for various other things.
Our concern now is being able to edit the WPF client while debuging the service. Many of the developers will keep the service running a large part of the day when making changes in the client. But it looks like with this setup, when you start debuging the service, Visual Studio will not let you edit any of the other code in the solution.
Is there a way around this, so that you could have the service running whenever you want, and still be able to edit the WPF and CS files in the other project? Or should these two parts stay in two separate solutions?
You'll want two instances of Visual Studio: one doing the debugging of the service and the other one for coding.
You could also imagine having the service running without the debugger attached, and only attach it manually when you're ready to launch/debug the client you were working on.

Debugging different projects in VS6

I have 3 projects in a VS6 workspace.
One is the main program, which calls - depending on configuration - one or both other progams. To call the other programs a exe is executed.
If I want to debug and set breakpoints in one of the subsequent programs, I get an error that breakpoints could not be set and have been deactivated.
Are there any VS6 settings I can check?
This is a legacy tool and neither the architecture nor VS6 can be changed. To make things worse I am not very familiar with VS6.
I don't remember exactly the behavior of VC6, but i think you can start 3 instances of Visual Studio, each containing one of the projects (you'll have to create 3 different workspaces). Within each instance you can debug one program. This at least worked with later Visual Studio 2005.
A common reason for that error is if you have set one or more of the components to build in Release mode. Make sure that they're all set to build in Debug mode.
Can't remember where those settings are I'm afraid, but I think they're fairly easy to find (under some project menu?).

Why use Windows Installer XML (WiX) over VDPROJ?

Why should one go for Windows Installer XML (WiX) when we have in built .net MSI installer?
It would take me hours to rant about everything I hate about VDPROJ. I won't because in my (expert) opinion it's already settled law that VDPROJ sucks. If your install is so simple that you haven't noticed any problems, then be my guess and stick with it. But if you already find yourself fighting the tool trying to get it to do things it doesn't do, then take my advice and dump it fast for WiX.
10 things I hate about VDPROJ
No MSBuild Support. Sure, you can call devenv from the command
line but it's not as good.
No exposing of the critical concept of
a component. Every file/reg key is a keyfile of it's own component.
No effective way to fully exclude automatic dependency scanning.
Shortcuts are always Advertised
No way to describe a service.
No way to describe many things which leads to overuse of custom
actions.
No way to fine control the scheduling / execution of
custom actions. Too abstracted.
Abstraction is wrong. Deferred
CA's are scheduled with Impersonation which breaks on Vista.
Various limitations lead you down a path of massaging the built MSI
during postbuild to get around all the limiations. Results in a
very poor build automation hacks.
Merge Module directory tables
are authored incorrectly.
100 other things suck that I'm not
remembering right now.
The introduction of WiX tutorial gives the basic idea about WiX advantages comparing to other setup development tools (including VS setup projects):
declarative approach
unrestricted access to Windows
Installer functionality
source code instead of GUI-based
assembly of information
complete integration into application
build processes
possible integration with application
development
support for team development, both
in-house and third-party
free, open source
Hope this helps.
Visual Studio deployment packages can only be built by visual studio. They cannot be built using plain MSBuild command lines, which makes them less than ideal for e.g. build servers.
All the above answers have included most of the annoying features of Visual studio setup projects (.VDPROJ), one thing that most people have missed.
.VDPROJ file format is such that, and if we make a small
change to one single entry it completely rewrites all the entries
within which makes it impossible to merge changes from 2 different
branches.
Some of us don't want to use / can't use the .NET installer.
Some of us don't want to have to install Visual Studio to distribute a program, written in, say, Borland Delphi. WiX and .NET have nothing to do with one another.
WiX provdes a much more complete feature set than the .NET installer.

Resources