Visual Studio Code and web pages RRS feed

  • Question

  • User-352524747 posted


    how to run on a localhost a web page or a single page from visual studio code? Preferably a web page with razor v2.

    I own a web page build on razor v2 and also have bin files. How to open it using visual studio code and run on localhost?

    Wednesday, April 17, 2019 9:37 AM

All replies

  • User-893317190 posted

    Hi dow7,

    If you want to open a .net core  mvc project with  vs code, you could open  your project's folder where bin folder is in using vs code.

    Then press F5, if you haven't installed extension vs code need to  open a .net core project, it will  ask you to install these extensions, please let it install these extensions.

    Then you should add launch.json to your project.

    Please click  add configuration and choose local .net  core web app.

    It will generate template code for you.

    Mine is ,  you could also paste mine to your project. But please change to your own version.

    "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/CoreProject.dll" specifies the dll  of your project. please change to your own dll's path.

    /netcoreapp2.0/CoreProject.dll  may differ.

        "version": "0.2.0",
        "configurations": [
                "name": ".NET Core Launch (web)",
                "type": "coreclr",
                "request": "launch",
                "preLaunchTask": "build",
                "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/CoreProject.dll",
                "args": [],
                "cwd": "${workspaceFolder}",
                "stopAtEntry": false,
                "launchBrowser": {
                    "enabled": true
                "env": {
                    "ASPNETCORE_ENVIRONMENT": "Development"
                "sourceFileMap": {
                    "/Views": "${workspaceFolder}/Views"

    Then press F12 , you should open the project with vs code.

    Best regards,

    Ackerly Xu

    Thursday, April 18, 2019 2:17 AM
  • User-352524747 posted
    I mean open an existing web page razor 2 folder, previously build with visual studio web developer and webmatrix.
    Thursday, April 18, 2019 5:44 AM
  • User-893317190 posted

    Hi dow7,

    Not clear about your problem

    I tried this way using an existing asp.net core mvc project created by visual studio.

    And  vs code  could compile the project  automatically.

    Do you mean you only have compiled project dll, razor folder and don't have the project source code?

    Best regards,

    Ackerly Xu

    Thursday, April 18, 2019 6:39 AM
  • User-352524747 posted
    Let’s say i want to try this code that is based on web pages razor 2:


    It’s not MVC or Razor pages 3.

    Do i have to get the bin (and all .dlls inside) folder, web.config from an existing project that runs on razor version 2 or can i install them again from visual studio code?
    Thursday, April 18, 2019 10:18 AM
  • User-893317190 posted

    Hi dow7 ,

    Not sure this is what you want .

    I have tried to create a core web application with pages folder, and open the folder using the same way.

    Below is the result.

    If this doesn't work , could you should the  structure of your project folder?

    Best regards,

    Ackerly Xu

    Friday, April 19, 2019 5:22 AM
  • User-352524747 posted

    This is the structure


    Or this one from Mike: https://github.com/mikebrind/StateManagement

    Friday, April 19, 2019 9:05 AM
  • User-893317190 posted

    Hi dow7,

    I think you should customize your task


    This is a repo which is 6 years ago , and .net core doesn't use web.config. It uses appsettings.json.

    Best regards,

    Ackerly Xu

    Friday, April 19, 2019 9:59 AM