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

Add support for Embedded Resources #76

Open
cezeta1 opened this issue Sep 10, 2024 · 2 comments
Open

Add support for Embedded Resources #76

cezeta1 opened this issue Sep 10, 2024 · 2 comments

Comments

@cezeta1
Copy link

cezeta1 commented Sep 10, 2024

The project I'm currently working on has the .cshtml templates as embedded resources, so I'm trying to use them from the assembly.

My approach is to configure the MvcRazorRuntimeCompilationOptions as stated on the documentation, but using an EmbeddedFileProvider instead of a PhysicalFileProvider.

The template in this example exists in the assembly at xxxx.EmailSender.Templates.en-Default.cshtml

Services setup:

image

When trying to find and render the template:

image

image

I tried with different route configurations, but none of them worked. Seems like the viewEngine appends a '/' automatically, assuming it's a physical path. I'm not that knowledgeable regarding Razor Templating, is this something approachable or is it just a limitation of the viewEngine that is tied to the expected MVC-style routing?

Thank you for your help!

@soundaranbu
Copy link
Owner

Hey @cezeta-hub, thanks for reporting the issue. I'll have a look at this and let you know. If possible I'll add a working sample to the repo.

@cezeta1
Copy link
Author

cezeta1 commented Sep 10, 2024

Great! For the time being I'm using a workaround, including the files both as physical and embedded in the .csproj. Which is not really ideal but works for now.

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

2 participants