I have all the pieces in place:
- Synology NAS
- C# Console app written with .NET 7
- An internet connection
I have the internet connected to my NAS. Now how do I get my console application on it and run it?
Not really familiar with Synology, but you could build and run it as a docker container. https://learn.microsoft.com/en-us/dotnet/core/docker/build-container
Synology supports Docker so I think that’s the answer
I think only on certain models (not the home arm systems).
Which Synology NAS? Is it one of the ARM based ones or an Intel based one? You’ll need to compile targeting the right arch.
For the actual scheduling, you can schedule jobs through the web UI. Control panel > task scheduler. I have a few scheduled jobs on mine, but they’re just bash scripts.
Install the Mono package using the package manager. Then you should be able to copy your application to the NAS and run it in a terminal.
I don’t think you need mono. Net 7 can complete for Linux natively.
This is a bit outdated with .NET Core. You can just compile it for a Linux target or install the .NET runtime from Microsoft.
I’m not sure Mono supports all the newer language features.
Unless they’ve updated it since I last checked, it does not. I remember it being stuck on C# 7 or so, with limited C# 8 features. Or maybe it was C# 6 with limited C# 7 features. Either way, we’re looking at C# 12 coming out sometime soon.
Is this something you want to run manually or automatically? If you want to run automatically either look into dotnet service workers, or run the console app with a crontab.
You can use https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish to create an executable. Then you would just transfer the resultant files, or file if you publish as a single executable file.