Convenient way to launch one of several project in Visual Studio - visual-studio

My solution contain about 50 projects
and there are 2 projects I usually launch for debugging (one is for web GUI and another one is for buisness logic).
Often I launch/debug just one of those two projects. but sometimes I need them both started under debugger.
Currently I do so: I write name of a project in the Solution Explorer's filter input, then "Debug - Start new instance"
My question is: is there a (more) convenient way to launch these projects from Visual Studio (2019)?
I know about the multiple startup projects, but I rarely need to launch both project.

Related

Debug Multiple Microservices in 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...

Visual Studio 2015 multiple uwp apps with same code

I am trying to run multiple apps with the same code, the only differences are application names, icons and the splashscreen.
I am already 100 % sure that my approach must be complete crap, but here is my approach:
I copied the excisting project specific configuring files, changed all file names to the new project, replaced references inside these files and imported this project back to the solution, because creating a complete new product within the solutions ignores all yet created files so I wanted to save some time. Now have 1 solution (I thought of this as the product) and 1 projekt for each customer, all targets sharing all code, except the project configs with the ids, names and icons etc..
But when I try to build any of the project I get these errors
Error occurred while restoring NuGet packages:
The process cannot access the file
'C:\...\project.lock.json'
because it is being used by another process.
Or the assembly is used by another application.
So, this can't be the right way to do what I want to do by Visual Studio, I'm looking for the right way to handle 1 base-product but many customer-specific-apps with Visual Studio 2015.
Sadly I couldn't find any tutorial for that yet.
Maybe I'm searching with the wrong description or naming, I thought of projects as targets in Xcode.
A link to a proper tutorial would already do the job for me.
Thanks!
According to your description, I think what you want is building multiple branded apps from a single Visual Studio solution. If so, here is a nice article: Multi-Branded Apps in Visual Studio (Windows 10 UWP) you can refer to.
The key point here is using separate build configurations for each app and then using Pre-build commands to create the app package.
For more info, please see Understanding Build Configurations and Specifying Custom Build Events in Visual Studio.

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.

Running two projects at once in Visual Studio

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).

Visual Studio debugging is not attaching to WebDev.WebServer.EXE

I have a solution with many projects. On Debug, I have three web projects that I want to start up on their own Cassini ASP.NET web development servers. In the solution properties → Common Properties → Startup Project, I have multiple startup projects chosen with the three web applications' Action set to Start. All three web development servers start, and all three web pages load.
However, Visual Studio is only attaching to two of the WebDev.WebServer.EXE processes. I have to manually go attach to the third process in order to debug it with the debugger.
This behavior just started happening, and I'm at a loss as to how to troubleshoot this.
Also to note, I have stopped and restarted the development servers several times with no change in behavior. Also, when attaching to the process manually, I see that the Type property of the two automatically attached WebDev.WebServer.EXE processes is Managed, while the Type property of the unattached WebDev.WebServer.EXE process is TSQL, Managed, x86. When looking at the project's properties, however, I am targeting AnyCPU, and do NOT have SQL Server debugging enabled.
The two projects that attach correctly are C# web applications.
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
The project that is not attaching correctly is a VB.NET web application.
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
The behavior is the same on another workstation. So odds are that it's not a machine-specific problem.
This might be a shot in the dark, but I would look at the csproj files, to see if the one that isn't working has any obvious differences. In particular, I would look for a <ProjectTypeGuids> element. Anything that relates to web-hosting is of interest too, of course; so anything under:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
(or similar, depending on your flavor of project; compare between the 3 for anything that looks out of place)
Right click on the main solution -> Properties -> Common Properties -> Start Up Project ->
Make sure it's set to "Multiple startup projects" and all are set to "Start" instead of none or start without debugging.
Also double check each projects .user file and make sure AlwaysStartWebServerOnDebug
is set to true along with any other debugging options.
I set multiple startup projects and choose each of the web applications in the properties of the solution (Right click the solution in Solution Explorer → Properties).
Is the third project an IIS web project (set in properties)? We have numerous IIS projects that run together and we don't have any issues debugging.
Try solution → Properties → Configuration Properties → Configuration and see what projects get build and when.
Not sure what the problem might be, but when I've had problems with complex projects before I've found it helps to look at the .vbproj or .csproj files directly.
Have you tried creating a new VB.NET project and simply copying over the files from the non-working project?
I'd also try adding a 4th, very simple C# web application project to see if perhaps 3 is some sort of magic number for your configuration (though I'm currently working on a solution with more than 3 and have no problems debugging). You could do the same with a simple VB.NET web application - you'll know then whether it's a problem with webserver #3, VB.NET in general, or your specific project.
Is debugging enabled in the Web.config file of the web application? Is it set to Debug mode when you start it in Visual Studio?

Resources