❔ Please point me in the right direction. WPF + Windows Service app.
I'm quite new to C# but I already have a good bit of experience programming Python, JavaScript and a little C.
I'm looking to rewrite a very small program we use in our organisation to perform backups of certain files on our shared drives.
Our current program is a python app with a Tkinter GUI that saves it's config in a SQLite database. It's run headlessly in order to perform the backups.
I'd like the new app to run as a windows service to perform the backups (It'd use dedicated credentials to access the UNC shares).
Instead of using a central SQLite file I'd like the client to communicate with the service to get/set the configuration.
Currently I'm looking at using.
.NET 4.8. Not the most modern but supported everywhere and won't require too many additional dependencies.
WPF for the GUI. See above.
SQLite to store config and logging information that wouldn't seem appropriate for the Event Log, e.g. the full list of backed up files.
An MSI installer
Ideally I'd like to use the windows built-in RPC to communicate, similarly to how mmc does it. This would let me support connecting to local and remote PCs using windows authentication. Though I'd also be happy using gRPC locally with an AF_UNIX socket.
Unfortunately I've had a lot of trouble locating tutorials and relevant documentation to the point that I'm wondering if I'm barking up the wrong tree. Any pointers in the right direction would be greatly appreciated.
Also what little I did find, including the guides on how to create MSIs was very Visual Studio centric. I prefer to use VSCode when learning new languages for minimal hand-holding but I'm happy to use Visual Studio if required.
15 Replies
Hi,
First of all, I wouldnt use 4.8. Go to .net 6 or 7. It has the same possibiliteis but is has also the advantage of being able to create a package wich is completely independant (no framework needed and also compatible with multi os except the WPF part.).
If you use a database (you can use the entity framework and for filling it, you can use a website).
Next I would advice you to look at Worker Service template. there you can create a service for youre needs.
+ 1 for .NET 7 (or 8, it's coming out next month)
if you don't want the burden of an extra dep, you can publish self-contained at the cost of a larger publish size
On a second closer look worker services with dotnet 7 are starting to look ideal. There's already a nice guide on gRPC via AF_UNIX and MSIX packaging looks more straightforward than MSI.
What are the benefits? For context I work in healthcare in the UK. 32bit winforms apps that treat not responding like a loading screen are the norm.
@xRDG .NET 7/8 or self-contained publish?
.NET 7/8 Vs 4.8. I'm not too worried about an extra few MB
significantly better tooling and dev experience
(also, the self-contained publish is gonna be a lot more than a few extra MB, though you can use trimming to cut that down a lot)
Ah yes ~200MB. Will MSIX packaging share dependencies between apps?
in MSIX terms, you do that with a framework package
annoyingly, I don't think there's one for .NET yet for... reasons
Reasons? But you can share the Windows App SDK inc. WinUI 3?
I don't know why there's no framework package yet, there's no technical reason (afaik) why there couldn't be one
as for WASDK, that has a framework package available
Amazing, thanks for your help. Finally I was originally considering WinUI 3, even more now with .NET 7. What's your opinion on using it for very data-heavy apps? A lot of the apps I regularly deal with are pretty much just a wrapper around a really nice table widget.
you'll want to ask in #gui or $uwp about WinUI 3, I haven't used it myself
👍 Thanks again for your help.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.