-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The type or namespace name 'Razor' does not exist in the namespace 'RazorLight' #522
Comments
Bumping in hopes someone has an idea. |
I'm getting the same error in a .NET 7.0 project. Here is the message:
|
Hi, I have the same error with my cshtml in a .NET standard 2.0 class library used by a .NET 4.6.2 console application. Regards Here the code of my Console Application (.NET 4.6.2) :
And now the code of my ClassLibrary .NET 2.0 Standard :
And my report.cshtml :
And the result is : TemplateCompilationException: Failed to compile generated Razor template:
See CompilationErrors for detailed information Note that :
|
Hi, I found the solution for my part : And it's solves my problem. |
Describe the bug
We are trying to migrate a .NET Framework solution to .Net core/.Net 6. In doing so, our infrastructure projects in the solution that power our 2 web application projects have been converted to .Net Standard 2 so we can have the updates live while migrating the web apps. In one of the .Net Standard 2 projects, we need to compile .cshtml views with models so I tried to use RazorLight. I've had to install a number of nuget packages in the web app but have finally gotten past all of those exceptions and now I'm at, what I hope is, the last of the exceptions. When I try to use the CompileRenderStringAsync as below I get the error "The type or namespace name 'Razor' does not exist in the namespace 'RazorLight'".
To Reproduce
Create a .Net Standard 2 library referencing RazorLight. Create a .Net Frameworks 4.7.2 web app and reference the first library app. Create a call through a button or something in the web app that tries to call the .Net Standard's implementation of RazorLight.
Expected behavior
Expecting... or hoping, to be able to compile .cshtml views.
Information (please complete the following information):
The text was updated successfully, but these errors were encountered: