Skip to content
Razor tooling for Visual Studio Code
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
.vscode
.vsts ci you an npm for great robustness Nov 29, 2018
build
client
modules
src Expand NormalizeIndex to understand empty documents. Mar 21, 2019
test
.editorconfig
.gitattributes Add initial git and README.md pieces. Jun 25, 2018
.gitignore Move client logic into a new NPM package project (#117) Sep 13, 2018
.gitmodules Depend on current Razor - remove submodule. Sep 20, 2018
CONTRIBUTING.md
Directory.Build.props
Directory.Build.targets Add support for 3.0 Razor projects. Jan 12, 2019
LICENSE.txt
NuGet.config
NuGetPackageVerifier.json
README.md
Razor.VSCode.sln
build.cmd Use KoreBuild and add Razor.VSCode.sln. Jun 25, 2018
build.sh
korebuild-lock.txt
korebuild.json Update to latest Razor Jan 12, 2019
omnisharp.json Disable script project system for repo. Oct 4, 2018
run.cmd Use KoreBuild and add Razor.VSCode.sln. Jun 25, 2018
run.ps1 Update bootstrappers and korebuild.json. Aug 13, 2018
run.sh Set executable bit on build.sh and run.sh Oct 2, 2018
version.props

README.md

Razor.VSCode

The Razor syntax provides a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content. This repo contains the tooling to enable Razor in Visual Studio Code. The Razor tooling ships as part of the Visual Studio Code C# extension.

This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the Home repo.

Get started

To use the Razor tooling for Visual Studio Code:

Disabling the Razor tooling

To disable the Razor tooling in Visual Studio Code:

  • Open the Visual Studio Code User Settings: File -> Preferences -> Settings
  • Search for "razor"
  • Check the "Razor: Disabled" checkbox

Building from source

Prerequisites:

  • Visual Studio Code + latest C# extension

  • Node.js (8.12.0 or later)

  • Clone the repo and restore Git submodules by running the following:

    git clone https://github.com/aspnet/Razor.VSCode.git
    cd Razor.VSCode
    git submodule update --init --recursive
    

This repo uses the same set of build tools as the other ASP.NET Core projects. The developer documentation for building is the authoritative guide. Please read this document and check your PATH setup if you have trouble building or using Visual Studio Code

To build at the command line, run build.cmd or build.sh from the solution directory.

Run in Visual Studio Code

To run the built Razor tooling in Visual Studio Code:

  • In the client directory run the following:

    npm install
    npm run compile
    
  • Open the solution folder in Visual Studio Code

  • Set the "razor.disabled" setting to true in the Visual Studio Code Workspace settings (File -> Preferences -> Settings -> Workspace Settings)

  • Run in the debugger (F5) using the Extension launch profile

  • A new Visual Studio Code instance will open as an Extension Development Host

  • Try out Razor tooling features in Pages/Index.cshtml or any other Razor file

    • NOTE: there may be a delay while the Razor Language Service starts up. See the Razor Log and OmniSharp log in the output window (View -> Output) to see the current status

Run all extension tests

To run all extension tests:

  • Close all instances of Visual Studio Code

  • From the client directory run:

    npm test
    
You can’t perform that action at this time.