coravel
coravel copied to clipboard
Mailer cannot find view templates when using .NET 6
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.
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.
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!