Dev, Microsoft

Dev Tunnels: A Game-Changing Tool for Mobile Developers

Mobile app developers face a frustrating hurdle when building backend services: the separation between localhost and emulators/devices. Debugging on your local machine is different than testing on emulators or physical devices due to separate network stacks. Connecting these environments to access your local backend can be challenging and time-consuming.

Visual Studio 2022’s new Dev Tunnels feature solves this problem by closing the gap between localhost and external devices. Dev Tunnels creates a unique, public URL that tunnels to your local computer. This allows you to securely expose localhost to emulators, devices, and teammates to streamline testing and debugging.

To get started, simply update to the latest version of Visual Studio 2022. Then, open the debug dropdown menu and select “Create tunnel” to configure a new Dev Tunnel for your active project.

This opens the Dev Tunnels configuration window. Here you can name your tunnel, make it persistent or temporary, and choose whether it will be private, organizational, or public. Public tunnels can be accessed by anyone with the URL.

Once created, run your backend and Visual Studio will provide a unique URL to access your local environment. You can revisit the Dev Tunnels window anytime to manage existing tunnels.

With your Dev Tunnel set up, you can now test APIs, connect mobile apps, and even debug remotely with colleagues. Set a breakpoint in your API code and it will hit when the tunnel URL is called, since it routes to your local machine.

For .NET MAUI developers, Dev Tunnels enables easy integration between device apps and local ASP.NET Core backends. In Visual Studio, generate a dev tunnel URL that points to your API project, then use that URL in MAUI to create a seamless connection between environments.

Beyond mobile, web developers, serverless developers using Azure Functions, and team collaboration benefit from Dev Tunnels. The CLI extends Dev Tunnels to enable tunneling anywhere for advanced scenarios.

With its flexibility, security and convenience, Dev Tunnels offers a ground-breaking improvement to the developer experience. Now you can seamlessly test and debug apps on local hosts and external devices. Download Visual Studio 2022 today to accelerate your workflows with Dev Tunnels!

For more information: Dev tunnels documentation