You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an ASP.NET Core Clean Architecture project that uses Azure Functions to send out emails. The email templates are stored as .cshtml files in the Services/EmailService/Templates folder. These templates use @model to bind to a DTO located in Services/EmailService/Models/DTOs.
Since RazorLight compiles the templates at runtime, missing @model or @using directives will not be caught during the build process and these errors only surface at runtime when emails are sent out.
So far, I've modified the SDK to Razor in EmailService.csproj with the RazorCompileOnBuild, RazorCompileOnPublish and AddRazorSupportForMvc properties set to true
Before modifying the SDK, the solution was able to be built with zero error reported even with missing @model or deliberate @Model.missingProperty usages in the .cshtml template files
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on an ASP.NET Core Clean Architecture project that uses Azure Functions to send out emails. The email templates are stored as .cshtml files in the Services/EmailService/Templates folder. These templates use @model to bind to a DTO located in Services/EmailService/Models/DTOs.
Since RazorLight compiles the templates at runtime, missing @model or @using directives will not be caught during the build process and these errors only surface at runtime when emails are sent out.
So errors as follows aren't caught during build:
So far, I've modified the SDK to Razor in EmailService.csproj with the RazorCompileOnBuild, RazorCompileOnPublish and AddRazorSupportForMvc properties set to true
Before modifying the SDK, the solution was able to be built with zero error reported even with missing @model or deliberate @Model.missingProperty usages in the .cshtml template files
Beta Was this translation helpful? Give feedback.
All reactions