Does RazorEngine Razor.Parse (...) raise an exception from ServiceStack and Markdown?

I followed this simple example from a website and I got the error below when it calls Razor.Parse. How can i fix this?

http://razorengine.codeplex.com/

string template = "Hello @Model.Name! Welcome to Razor!"; string result = Razor.Parse(template, new { Name = "World" }); 

error CS0234: The type or namespace name "Markdown" does not exist in the namespace "ServiceStack" (do you miss the assembly reference?)

+4
source share
2 answers

Not sure why you contacted http://razorengine.codeplex.com

The "ServiceStack" error suggests that you want to use the Markdown mechanism in ServiceStack , in which case you should refer to the RazorEngine.dll that comes with ServiceStack, and not the one that is located at razorengine.codeplex.com if it is done here.

+2
source

I would suggest that one of two things happened. <razorEngine> added to the configuration file in the <razorEngine> configuration section, or the AddNamespace method AddNamespace called somewhere to enable the import of the namespace into the compiled template.

The end result is that namespaces are added to the generated class file, but there are no links. RazorEngine will automatically reference any loaded builds in AppDomain .

+1
source

Source: https://habr.com/ru/post/1385447/


All Articles