Welcome to Microsoft Q&A Platform!
Thank you for bringing this to our attention. It seems that the issue arises due to differences in how file paths are resolved between local Windows environments and Azure Functions running on Linux in the Flex Consumption plan. While your code is forming the templatePath
correctly, the root path may not be resolved properly in the Azure environment.
- Use Path.Combine: This could help the path separators are handled correctly across different platforms.
- Get the Root Path: You could use AppContext.BaseDirectory to get the root path of your Azure Function app. This will give you the directory where your application is running.
Please refer the below documentation on the example:
https://learn.microsoft.com/en-us/dotnet/api/system.appdomain.basedirectory?view=net-9.0
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.