A - Introduction

In Visual Studio, we knew when we run an ASP.NET app, the Visual Studio itself will create a virtual server (IIS Express), letting the app running against. How can we run an HTML page from a Visual Studio Code? We will discuss the issue in this article.

We will give two solutions,

B - Browser Preview in the VS Code

We knew we cannot run an HTML page within VS code terminal. However, we can add an extension and open a browser preview right in the VS Code:

Extensiton Installation:

After installation, Right Click the HTML file in the folder:

Choose Live Preview: Show Preview:

In the newer version of VS Code, choose Show Preview:

Then we will see a preview frame opened in VS Code paralell with the Terminal. Such as.

C - Open in Browser

The same, we need to add an extension:

Extension Installation:

Run:

Right Click the HTML file, and choose either

References: