Kiran B
Kiran B

Reputation: 715

Could not load type 'Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine'

I am using RazorEngine.NetCore in .Net Core 3.1 and when I run below code

string template = "Hello @Model.Name!";
        var result = Engine
            .Razor
            .RunCompile(template,
                "templateKey",
                null,
                new
                {
                    Name = "World"
                });

I am getting the following error

'Could not load type 'Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine' from assembly 'Microsoft.AspNetCore.Razor.Language, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.'

Upvotes: 2

Views: 3580

Answers (1)

hnx8
hnx8

Reputation: 36

What version of RazorEngine.NetCore are you using? If you are using "2.2.6" or below, change it to "3.1.0".

Upvotes: 2

Related Questions