'Renaming embedded resources using wildcards in .Net Core 3.1

I'm currently embedding some .htm files for emails in a .Core 3.1 application using the .csproj file:

<EmbeddedResource Include="..\EmailTemplates\*" />

This works, but only file name and extension comes through, and any folder structure is lost. I'm currently having to specify each file to rename e.g.:

<EmbeddedResource Update="..\EmailTemplates\Template.htm" Link="EmailTemplates\Template.htm" />

Is there a way to specify everything included should be prefixed with "EmailTemplates"?

I have tried the following that looked promising:

<EmbeddedResource Update="..\EmailTemplates\*" Link="EmailTemplates\%(Filename)%(Extension)" />

But this has no effect and any files are still listed in the manifest by their filename. I've searched around and although there's a lot of information on how to rename manifests, there's not a lot on renaming the files within them.

I've got a growing number of templates and individually specifying them all isn't very maintainable.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source