Introduction

In this article, we will explore the new feature of Microsoft Visual Studio 2022, which allows you to test your Web Application on other PC, Mobile or Tablets while debugging your project. This feature is called Dev Tunnels.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

What Is Dev Tunnels?

The dev tunnels feature of Visual Studio 2022 enables ad-hoc connections between machines that can't directly connect to each other. A URL is created that allows any device with an internet connection to communicate to an ASP.NET Core project while it runs on localhost.

Make an app temporarily available to others over the internet for a presentation or to invite others to review your work on a web app or API.

Prerequisites

Enable Dev Tunnels

Create a new ASP.Net Core MVC Project

Create Dev Tunnel

Step 1

Click on the arrow icon beside the run button on your visual Studio. Then Dev Tunnels and then Create a Tunnel.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Step 2

In this wizard, you need to enter the below details.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Sign into Visual Studio with your GitHub or Outlook account, and then select your GitHub or Outlook account.

Step 3

Select OK. Now you will get a confirmation message as shown below image.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Run Project with Dev Tunnel

To run your Web App Or Web API, click on the arrow icon near the Run button, then Dev Tunnel, and select your created Dev Tunnel if not selected.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Now click on Run Button.

When you run it first, it will show a confirmation message, as shown in the below image. Click on the Continue Button.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Now you can see that your project is running on a live URL.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

You can share this URL with anyone, and they can also run and test this project. Here I'm generating a QR code from chrome to check this project on my mobile.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

If you change your project, other users also get updated changes in their browsers.

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Debug Dot Net Core Project in Mobile Or Tablet using Dev Tunnels

Note: This live URL works until you run this project in Visual Studio. This URL will not work if you stop debugging from your Visual Studio, this URL will not work.