Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure PreserveCompilationContext is set to true #537

Open
JozefGula opened this issue Nov 14, 2023 · 0 comments
Open

Make sure PreserveCompilationContext is set to true #537

JozefGula opened this issue Nov 14, 2023 · 0 comments

Comments

@JozefGula
Copy link

Hello, can someone help me?

I have an ASP Net 7.0 project with RazorLight 2.3.1. I added "PreserveCompilationContext" to my *.csproj. However, I keep getting this error:

"Can't load metadata reference from the entry assembly. Make sure PreserveCompilationContext is set to true in *.csproj file"

I tried various combinations with PreserveCompilationContext but without success. Nothing in the FAQ solves my problem.

var engine = new RazorLightEngineBuilder()
	.UseEmbeddedResourcesProject(typeof(Program).Assembly, typeof(Program).Namespace)
	.UseMemoryCachingProvider()
	.SetOperatingAssembly(typeof(Program).Assembly)
	.EnableDebugMode(true)
	.Build();

return await engine.CompileRenderAsync("Views.EmailTemplates.Email", model);

Any ideas? Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant