question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I get RazorLightException when trying to call lib that contains razor templates from console application

See original GitHub issue

Exception text:

RazorLight.RazorLightException: 'Can't load metadata reference from the entry assembly. Make sure preserveCompilationContext is set to true in buildOptions section of project.json or in *.csproj file'

Here is the solution with isolated case: https://1drv.ms/u/s!AuXjDEud3Cas10ihf9jpraKC316w

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
mcintyre321commented, Apr 21, 2017

Add <PreserveCompilationContext>true</PreserveCompilationContext> to the csproj, worked for me!

1reaction
ForNeVeRcommented, Apr 16, 2017

@ossaltu, I suspect that you didn’t clean the project before rebuilding and trying that again. It was an issue for myself. I’ve just created the PR to add this warning to README.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Razor templates: Cannot find compilation library location ...
Publish-time compilation of Razor files is enabled by default. In my case, I did not need this feature, because my Razor templates were ......
Read more >
RazorLight
RazorLight. Use Razor to build templates from Files / EmbeddedResources / Strings / Database or your custom source outside of ASP.NET MVC.
Read more >
Razor Email Template Parsing From a .NET Core Console ...
So how do you run Razor template parsing outside of an MVC Web App in .NET Core? I found myself having to answer...
Read more >
Walkthrough: Creating an HTML Email Template with ...
Therefore, I try to make my folder and/or view names clearly unique like “ConfirmAccountEmail.cshtml” which is unlikely to have a matching route ...
Read more >
Razor file compilation in ASP.NET Core
Learn how compilation of Razor files occurs in an ASP.NET Core app.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found