Skip to content

How can I force a specific version of the Razor .cshtml editor in VS? #54068

Answered by daiplusplus
daiplusplus asked this question in Q&A
Discussion options

You must be logged in to vote

After spending too much time in Ghidra, I found the magic incantation...

So RazorVersionDetector (in Microsoft.WebTools.Languages.Html.VS.dll, in namespace Microsoft.WebTools.Languages.Html.VS.Razor), performs these checks in sequence:

  1. Does the filename end with .vbhtml? If so, then don't use the Razor Core editor.
  2. Does the project have the SupportsSystemWeb capability? Or does the project not have the .NET&CPS capability?
    1. If either of the above is true then check for the UseRazorV4Editor MSBuild property.
    2. If UseRazorV4Editor is undefined or not set to true then use the ASP.NET Web Pages version (described below)
    3. If UseRazorV4Editor is true then always use the Razor Core editor.
  3. Then …

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@NTaylorMullen
Comment options

@daiplusplus
Comment options

@NTaylorMullen
Comment options

Answer selected by daiplusplus
Comment options

You must be logged in to vote
12 replies
@NTaylorMullen
Comment options

@CZEMacLeod
Comment options

@NTaylorMullen
Comment options

@CZEMacLeod
Comment options

@NTaylorMullen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants