coravel icon indicating copy to clipboard operation
coravel copied to clipboard

Mailer cannot find view templates when using .NET 6

Open jtatsis opened this issue 2 years ago • 1 comments

Describe the bug When using a view as mail template the following runtime error appears: "Unable to find view '~/Views/Mail/myTemplate.cshtml'. The following locations were searched: ~/Views/Mail/myTemplate.cshtml"

Affected Coravel Feature Mailing

Expected behaviour The same project using .NET core 3.1 is working fine. .Net 6 adds compiled views to project assembly and does not create .view.dll.

jtatsis avatar Mar 04 '22 11:03 jtatsis

There is a way to fix this - which I'll be looking into / testing. Just to verify, did you get this working?

For example, adding <UseRazorSourceGenerator>false</UseRazorSourceGenerator> to your csproj may fix the issue.

I'll post any updates on .net 6 compatibility with the mailer here.

jamesmh avatar Mar 25 '22 12:03 jamesmh

Going to close. Upgraded the mailer to work with .NET 6+ (was a bit of work!)

If it doesn't work you might need to call app.MapRazorPages().

LMK if you have issues - thanks!

jamesmh avatar Aug 18 '23 01:08 jamesmh