We have an ASP NET Core 6 API application hosted on Azure App Service.
Together with the application we would like to deploy some external xml files that are used later on by the backend runtime. We have added them to the project and set CopyToOutputDirectory = true.
Have to questions:
- How to access these files from code in safe way? What we tried is
- Assembly.GetExecutingAssembly().GetName().CodeBase)?.Substring(6)to get base path but it looks hacky.
- _webHostingEnvironment.ContentRootPathbut it returns wrong location in development (project root folder instead of /bin)
- using relative path Path.GetFullName("file.xml")but it returns project root folder in development as well
- We saw that there is another property that can be set on file called CopyToPublishDirectory. When it should be set? We set onlyCopyToOutputDirectoryand it seems to work also when doing dotnet publish. Any reference?
 
    



