RazorLightException: Cant load metadata... PreserveCompilationContext
See original GitHub issueI’m getting the exception mentioned here: https://github.com/toddams/RazorLight/issues/44
RazorLight.RazorLightException: Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in *.csproj file
But I opened this because none of the suggestions resolved it. Clean/Rebuild wont fix, and adding <PreserveCompilationContext>true</PreserveCompilationContext>
wont fix. I am using a Core 2.0 Unit Test app, but that shouldn’t be any different than a simple console app.
Issue Analytics
- State:
- Created 6 years ago
- Comments:19 (2 by maintainers)
Top Results From Across the Web
Error: Can't load metadata reference from the entry ...
This problem is specific to RazorLight. Error: Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is ...
Read more >PreserveCompilationContext not configured by default - .NET
Learn about the breaking change in ASP.NET Core 6.0 where the PreserveCompilationContext property is no longer configured by default.
Read more >RazorLight
I'm getting "Can't load metadata reference from the entry assembly" exception. Set PreserveCompilationContext to true in your *.csproj file's PropertyGroup ...
Read more >Tests using razorlight fail - Build/Test Issues
An unhandled exception has occurred while executing the request. RazorLight.Compilation.TemplateCompilationException: Failed to compile ...
Read more >In my cake script, I can't use CompileRenderAsync.
(Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in *.csproj file. To Reproduce
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<PropertyGroup>
node.<PreserveCompilationContext>true</PreserveCompilationContext>
inside it.Where did you add
<PreserveCompilationContext>true</PreserveCompilationContext>
? Try putting it in “PropertyGroup”.Like this
I looked at the code in README and put it in ItemGroup, but it was not resolved.
I put it in PropertyGroup and I found it works.