Open Closed

Has the Text Templating system changed in version 7.0.1? #4539


User avatar
0
AdamMusson created

Hi, I had a working Text Templating Email with a layout using the Razor Engine in version 6.0.

Now I have updated the project to version 7.0.1 and it didn't compile due to the .withRazorEngine() line in the following code in the EmailTemplateDefinitionProvider class

 public override void Define(ITemplateDefinitionContext context)
        {
            context.Add(
               new TemplateDefinition(
                   "EmailLayout",
                   isLayout: true
               )
               .WithRazorEngine()
               .WithVirtualFilePath(
                   "/Templates/EmailLayout.cshtml",
                   isInlineLocalized: true
               )
            );


            context.Add(new TemplateDefinition("ConfirmEmail",
                                                typeof(HourcoinResource), 
                                                layout: "EmailLayout")
                                   .WithVirtualFilePath(
                                       "/Templates/ConfirmEmail.cshtml",
                                       isInlineLocalized: true
                                      
                                   )
                                  .WithRazorEngine()
            );

            
        }

To get the code to compile I had to remove the .WithRazorEngine() line

I thought there may have been an update and so following the TextTemplating documentation for version 7 I used the following command abp add-package Volo.Abp.TextTemplating.Razor and got the following message.

[13:03:04 WRN] 'Volo.Abp.TextTemplating.Razor' nuget package could not be found!

So now I receive the email but instead of it being rendered I see the @Body from the EmailLayout instead of the contents from the model.

It appears the documentation is therefore out of date. How can I get this to work in version 7? Has it moved to another package?

Kind Regards

  • ABP Framework version: v7.0.1
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

No Exception the email is sent but it isn't rendered by the razor engine as it doesn't seem to be there anymore.

  • Steps to reproduce the issue:"

1 Answer(s)
  • User Avatar
    0
    salih created
    Support Team .NET Developer

    Hello, can you perform the manual installation from this document?

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 16, 2025, 12:13