Tag Archives: Visual Studio Code

Debugging Multiple .NET Core Projects in VS Code

By Shahed C on October 13, 2020

Introduction

Originally written up in a GitHub repo while helping out another developer, this blog post explains how you can debug multiple .NET Core projects in Visual Studio Code.

To download the sample code, clone the following GitHub repository:

Opening VS Code

Launch VS Code with the project root as the current working directory. One easy way to do this is to type the word “code” followed by a dot “.” at a Command Prompt, Powershell window or Windows Terminal.

Powershell/Terminal Command:

code .
Powershell Command

If you already have VS Code open, use the built-in Terminal (Ctrl+`) to change the current directory to the project root.

In either case, you should end up with VS Code open with the Terminal open in the correction location (project root).

VS Code with Terminal panel

Launch Configuration

This project contains launch.json configuration for a .NET Core console project and a Web API projet.

Web API Launch Config
Web API Launch Configuration
Console Project  Launch Config
Console Project Launch Configuration

Debug Panel

In the Debug Panel of VS Code, observe that you can see both configurations, ready for launch.

Web API in Debug Panel
Web API in Debug Panel
Console Project in Debug Panel
Console Project in Debug Panel

Setting Breakpoints

In the code for each project, set a breakpoint that’s easy to identify.

Breakpoint in Web API project
Inside Get() method within WeatherForecastController.cs in Web API project 
Breakpoint in Console project
Console.WriteLine in Console project 

Debugging with Breakpoints

From the aforementioned Debug Panel, run the Web API project and then the Console project by clicking the Play/Debug button for each launch configuration.

Note: when the web browser launches at the root of the website, you may browse to the WeatherForecast Controller manually, e.g. https://localhost:5001/WeatherForecast

You should see each program pause at the breakpoints you set earlier.

Breakpoint in Web API project
Breakpoint in Web API project
Breakpoint in Console project
Breakpoint in Console project

Continue Running

Press the Play/Continue button to continue running while debugging. Observe the output in a web browser (for the Web API project) or the Terminal within VS Code (for the Web API project)

Output in Web API project
Output in Web API project
Output in Console project
Output in Console project

Optional: Run Multiple Projects

As a bonus, I have added a Compounds section to the launch.json file.

    "compounds": [
        {
            "name": "Both Console & Web API",
            "configurations": [
                ".NET Core Launch (console)",
                ".NET Core Launch (web)"
            ]
        }

This will allow you to launch both the Console app (in the Terminal) and the Web API app (in a browser) in rapid succession, with 1 click.

Debugging multiple projects
Debugging multiple projects

ASP.NET Core 2.1 at CMAP August 2018

By Shahed C on August 8, 2018

I presented ASP.NET Core 2.1 at CMAP 2018.1 on Tue August 7, 2018. Here is the presentation material with the slides, links and my contact information. I’ve also included some links to more information to help answer some questions from the audience.

asp-net-logo

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/aspnet-core-21-the-future-of-web-apps-109106486

The new and improved ASP .NET Core 2.1 introduces some great new capabilities, the ability to host on multiple server platforms, and a number of new tools that you will want to get familiar with. Learn about the future of ASP.NET Core MVC, Web API, Razor Web Pages, SignalR, .NET Core Tools and Visual Studio 2017!!

Here are some links that mention information that may be useful to attendees who asked questions about the following:

Daniel Roth’s summary of what’s new in ASP .NET Core 2.1

OWIN in ASP .NET Core

Oracle with EF Core in ASP .NET Core

  • Excerpt: “The Oracle .NET team has announced they are planning to release a first-party provider for EF Core 2.0 approximately in the third quarter of 2018. See their statement of direction for .NET Core and Entity Framework Core for more information. Please direct any questions about this provider, including the release timeline, to the Oracle Community Site.”
  • From Article: Database Providers – EF Core | Microsoft Docs
  • Link: https://docs.microsoft.com/en-us/ef/core/providers/#future-providers

Using IdentityServer (via a Nuget package) in ASP .NET Core web app with Angular:

Video course on ASP .NET Core app with Angular using Identity, via Lynda

p.s. when creating a new Angular web project from VS2017, it appears that the Authentication option is not available, so we’re not able to add Identity support during file creation in an Angular app, the way we do it with ASP .NET MVC/Razor web apps. 

I also ran the following command in the command line, to attempt to create an Angular web app with the –auth flag for Individual authentication, but this is not a valid option.

>dotnet new angular --auth Individual -o AngWebWithAuth

Compare with a regular ASP .NET MVC web app with the — auth flag, which works with no issues.

>dotnet new mvc --auth Individual -o MvcWebWithAuth

The “New Project” dialog in VS2017 has a link to the following page for more info on Identity options for OSS web projects:

ang-auth-options

The list mentions the following options:

 

ASP.NET Core 2.1 at NoVA Code Camp 2018.1

By Shahed C on May 14, 2018

I presented ASP.NET Core 2.1 and Visual Studio 2017 at NoVA Code Camp 2018.1 on Sat May 12, 2018. Here is the presentation material with the slides, links and my contact information.

asp-net-logo

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/aspnet-core-21-the-future-of-web-apps-97080858

The new and improved ASP .NET Core 2.1 introduces some great new capabilities, the ability to host on multiple server platforms, and a number of new tools that you will want to get familiar with. Learn about the future of ASP.NET Core MVC, Web API, Razor Web Pages, SignalR, .NET Core Tools and Visual Studio 2017!!

 

HoloLens + Cognitive Services and ASP.NET Core 2.1 Web Apps

By Shahed C on March 27, 2018

I presented the following at multiple events in March 2018. Here is the presentation material with the slides, links and my contact information.

Cloud-Backed Mixed Reality: HoloLens & Azure Cognitive Services

hololens-darkened

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/cloudbacked-mixed-reality-hololens-azure-cognitive-services

The upcoming ASP .NET Core 2.1 introduces some great new capabilities, the ability to host on multiple server platforms, and a number of new tools that you will want to get familiar with. Learn about the future of ASP.NET Core MVC, Web API, Razor Web Pages, .NET Core Tools and Visual Studio 2017!

ASP.NET Core 2.1: The Future of Web Apps

asp-net-logo

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/aspnet-core-21-the-future-of-web-apps

The upcoming ASP .NET Core 2.1 introduces some great new capabilities, the ability to host on multiple server platforms, and a number of new tools that you will want to get familiar with. Learn about the future of ASP.NET Core MVC, Web API, Razor Web Pages, .NET Core Tools and Visual Studio 2017!

 

 

Azure Functions @ Philly DevOps 2017

By Shahed C on October 17, 2017

I presented Azure Functions at Philly DevOps on Tue October 17, 2017. Here is the presentation material with the slides, links and my contact information.

azure-function-logo

Download PPTX or view slideshow below

SlideShare: https://www.slideshare.net/shahedC3000/going-serverless-with-azure-functions-80886075

Whether you’re new to cloud computing or have been using various cloud services over the years, Azure Functions opens the door to new workflows for development, deployment, devops and scaling. Learn about how you can go serverless with Azure Functions using a web browser, code editor or a full blown IDE.