Razorlight: The type or namespace name 'Razor' does not exist in the namespace 'RazorLight'

Created on 30 Jan 2018  路  5Comments  路  Source: toddams/RazorLight

Hi,

I receive this error along with other errors.

Could not load type 'Failed to compile generated Razor template:

  • (3:29) The type or namespace name 'Razor' does not exist in the namespace 'RazorLight' (are you missing an assembly reference?)
  • (12:56) The type or namespace name 'TemplatePage<>' does not exist in the namespace 'RazorLight' (are you missing an assembly reference?)
  • (15:66) 'GeneratedTemplate.ExecuteAsync()': no suitable method found to override
  • (17:12) The name 'BeginContext' does not exist in the current context
  • (18:12) The name 'WriteLiteral' does not exist in the current context
  • (19:12) The name 'EndContext' does not exist in the current context
  • (20:12) The name 'BeginContext' does not exist in the current context
  • (11:27) The name 'Write' does not exist in the current context
  • (11:33) The name 'Model' does not exist in the current context
  • (26:12) The name 'EndContext' does not exist in the current context
  • (27:12) The name 'BeginContext' does not exist in the current context
  • (28:12) The name 'WriteLiteral' does not exist in the current context
  • (29:12) The name 'EndContext' does not exist in the current context
  • (30:12) The name 'BeginWriteAttribute' does not exist in the current context
  • (16:0) The name 'WriteAttributeValue' does not exist in the current context
  • (16:124) The name 'Model' does not exist in the current context
  • (36:12) The name 'EndWriteAttribute' does not exist in the current context
  • (37:12) The name 'BeginContext' does not exist in the current context
  • (38:12) The name 'WriteLiteral' does not exist in the current context
  • (39:12) The name 'EndContext' does not exist in the current context
  • (17:13) The name 'Model' does not exist in the current context
  • (46:12) The name 'BeginContext' does not exist in the current context
  • (47:12) The name 'WriteLiteral' does not exist in the current context
  • (48:12) The name 'EndContext' does not exist in the current context
  • (49:12) The name 'BeginContext' does not exist in the current context
  • (19:73) The name 'Write' does not exist in the current context
  • (19:79) The name 'Model' does not exist in the current context
  • (55:12) The name 'EndContext' does not exist in the current context
  • (56:12) The name 'BeginContext' does not exist in the current context
  • (57:12) The name 'WriteLiteral' does not exist in the current context
  • (58:12) The name 'EndContext' does not exist in the current context
  • (64:12) The name 'BeginContext' does not exist in the current context
  • (65:12) The name 'WriteLiteral' does not exist in the current context
  • (66:12) The name 'EndContext' does not exist in the current context
  • (67:12) The name 'BeginContext' does not exist in the current context
  • (68:12) The name 'WriteLiteral' does not exist in the current context
  • (79:12) The name 'EndContext' does not exist in the current context

See CompilationErrors for detailed information
' from assembly 'Microsoft.AspNetCore.Razor,
Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

I'm using version 2.0.0-beta1

Most helpful comment

Well I get the exact same error using RazorLight, and from the callstack you could see it is from RazorLight.
I wonder why it got closed.

All 5 comments

Are you sure you're using the right library?

This looks like https://github.com/Antaris/RazorEngine library.

Well I get the exact same error using RazorLight, and from the callstack you could see it is from RazorLight.
I wonder why it got closed.

Just ran into this issue as well. If you previously used RazorEngine, make sure you remove all references to RazorEngine (such as @using RazorEngine) in your .cshtml templates.

Please re-open this issue as we're experiencing the same issue as @molinch and @xxeasterxx

I managed to resolve this by adding RazorLight as a reference in our main ASP .NET Core Web project as well as the library that uses RazorLight directly.

Was this page helpful?
0 / 5 - 0 ratings