I have files that I reference from inside by C# code such as:
public static string Canonical()
{
return File.ReadAllText(@"C:\\\\myapp\\\\" + "
Yes, put the file at the root of Azure Function project and set its property Copy to Output Directory
to Copy if newer
. Use code below.
public static async Task Run(HttpRequestMessage req, TraceWriter log, ExecutionContext context)
{
var data = File.ReadAllText(context.FunctionAppDirectory+"/CanonicalMessage.xml");
//etc
}
Check the doc for more details.
If we need to add this file from anywhere locally, right click on Function project, Edit
. Add Item below, relative or absolute path are both ok.
PreserveNewest