I have a .NET Core 2.0 solution containing 3 projects (DataAccess, Services, WebAPI). In the wwwroot folder of the WebAPI project I've created a templates folder that contains a couple of Excel template files. In Services I have an Export folder which contains the ExportService. The ExportService uses the templates to generate some reports. I have a private method that 'gets' the path to the templates directory. In fact I'm just specifying a relative path to it, which works fine when debugging, but not when I publish the project. How can I make the files available/reachable in my published app?
private string GetExcelTemplatePath()
{
var templatesDirectory = "..\\WebAPI\\wwwroot\\templates";
var templateName = "Excel_template_v1.xlsx";
var templatePath = Path.Combine(templatesDirectory, templateName);
return templatePath;
}