Antaris / RazorEngine

Open source templating engine based on Microsoft's Razor parsing engine
http://antaris.github.io/RazorEngine
Other
2.14k stars 577 forks source link

Using Kendo Mvc Helpers in Razor on Console App #467

Open serefbilge opened 7 years ago

serefbilge commented 7 years ago

I need to use Kendo Mvc components inside razors on a console app. It works fine without Kendo.

@using Kendo.Mvc.UI
@using RazorEngine.Host.Console.Helpers

...

<li>
     @(Html.Kendo().Barcode().Name("mascarpone").Value("Mascarpone")
                   .Encoding(BarcodeSymbology.Code128).Width(280).Height(100))
</li>

When I try like above(Kendo.Mvc is added as reference into project) razorengine throws exception below.

An unhandled exception of type 'RazorEngine.Templating.TemplateCompilationException' occurred in RazorEngine.dll

Additional information: Errors while compiling a Template.

Please try the following to solve the situation:

  * If the problem is about missing/invalid references or multiple defines either try to load 

    the missing references manually (in the compiling appdomain!) or

    Specify your references manually by providing your own IReferenceResolver implementation.

    See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details.

    Currently all references have to be available as files!

  * If you get 'class' does not contain a definition for 'member': 

        try another modelType (for example 'null' to make the model dynamic).

        NOTE: You CANNOT use typeof(dynamic) to make the model dynamic!

    Or try to use static instead of anonymous/dynamic types.

More details about the error:

 - error: (16, 11) The type or namespace name 'Kendo' could not be found (are you missing a using directive or an assembly reference?)

Is it possible to achive Kendo Helpers usage inside razors with Razorengine ?

jljaleahy commented 6 years ago

Hello,

Did you ever get this working... I am having a similar issue using Highsoft.Web.Mvc.Charts

This is the code:

@(Html.Highsoft().Highcharts( new Highcharts { .... rest of code here

This is the error:

Thanks for any help in this matter.