I am trying to use the Synology package ".NET 6.0 runtime" by hgy59 to create a small website. I am using the example of this post : Publish Net Core Web API in NAS Synology
I can't find the github or any repository where I can ask questions so here I am.
I am a bit of a noob regarding ASP.NET. I am usually developing in C# or VB but no web. But know I need it.
So, the question : How can I set the working directory to the wwwroot folder of the published app instead of '/usr/syno/synoman/webapi/ ?
Thanks
I have finally found a solution to my problem bellow so I post it there. It was indeed a problem with the root directory. To fix it : you need the following lines of codes
string basedir = AppDomain.CurrentDomain.BaseDirectory;
WebApplicationOptions options = new()
{
ContentRootPath = basedir,
Args= args,
WebRootPath = Path.Combine(basedir, "wwwroot")
};
var builder = WebApplication.CreateBuilder(options);
Yes the rootpath need to be set and pass to the builder. I had tried to modify the root path AFTER the creation of the builder but it was ignored and i had given up. But this works!