β Auto Updating WPF applications options and best practices
So I'm building an internally facing application for a client, I've spent some time getting to know WPF and C# as this is my first major project. My main issue is how to handle auto updates, I've researched a bit online but struggling to understand what the best options are as most of them see pretty limiting.
The application is being hosted with GitHub in a private repository, I initially had planned to handle updates entirely by using GitHub releases however open to suggestions on better/alternative ways to handle this. I come from a background of Full Stack development so have made heavy use of workflows and releases in the past but for Javascript and Python mainly so this is very much new teritory for me.
Any help would be greatly appreciated thanks π
77 Replies
One way would be https://github.com/velopack/velopack
GitHub
GitHub - velopack/velopack: Installer and automatic update framewor...
Installer and automatic update framework for cross-platform desktop applications - velopack/velopack
That looks amazing, exactly what I was looking for thanks a lot mate
If I use velopack, when users install the application (and use it to update) will this then require admin privileges, it isn't necessarily a deal breaker but would make life slightly easier if not. And if it does not, what are some of the limitations of setting it up to not require admin privileges
it does not
unless u have features that demand admin access
Okay perfect thanks π
and you can also include it on AfterBuild events in your csproj
so when u publish or build release it also builds the pack
oh perfect so I don't need to manually run the velopack command it'll do it automatically in the github release?
never tried integrating it on github but I suppose its possible
Integrating Overview | Velopack
To integrate Velopack into your application, you must initialise the Velopack as early as possible in app startup, and you should add update checking code somewhere.
I'll take a look into it. Just out of curiosity, do you recommend any IDE over Visual Studio for WPF development.
no
rider is nice but I prefer sticking to visual studio
damn, was thinking of checking out jet brains 'rider'
ah I see, I'll stick to the old but reliable
rider is a nice alternative yes, its just my personal preference to stick with vs
yeah I mean I can't go wrong with it being free, just need to get used to it having only used VSCode the change is similar and so different at the same time
also I do a lot of maui and avalonia stuff and last I heard rider doesn't do as well with those
oh nice, how have you found avalonia, I looked into using it instead but wasn't entirely sold
well yeah its a massive change since you're coming from a text editor into a full ide
getting used to take time but imo for c# in general its better experience
oh yeah, I've only really done Java and C++ before this with full IDEs and used JetBrains for it
also, do you have any recommendations for wpf control suites, I hate ui design so simple is better in my opinion
$wpfuilibs
MahApps
https://github.com/MahApps/MahApps.Metro
ModernWPF
https://github.com/Kinnara/ModernWpf
Material Design
https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
HandyControl
https://github.com/HandyOrg/HandyControl
WPFUI (Windows 11 inspired)
https://github.com/lepoco/wpfui
iNKORE.UIWPF.Modern (Fluent style)
https://github.com/iNKORE-NET/UI.WPF.Modern
damn I really am a novice here, thanks again.
:Ok:
$close
If you have no further questions, please use /close to mark the forum thread as answered
Final question I promise. I've setup like a basic login for the application
but I hate my implementation, and I know it's going to become a pain in the ass later on
:Hmm:
can you recommend any tutorials for handling authentication
or guides
it depends how you're handling it, whether u use MVVM or not, services, di, etc
normally the flow for me is
asp.net or php backend
and then I have services that communicate with my back end and delivery information to my viewmodel
which fullfils my view needs
as for the flow
Yeah I'm using MVVM, currently have the User setup as a service
I usually use UserControl as pages, depending on the scenario I have side bar menu
sure, so:
- user inputs credentials, click button, fire command,
- command calls method from service which verifies the credentials and returns a token
- viewmodel redirects user to the proper page
yeah so my setup is slightly weird as the application communicates directly with an oracle database, so I have a data access layer which the services then interact with to pull data directly, just because it's an internal application and reasonably full scale I didn't see the need for an API.
you see I prefer not doing that because then I have to worry about database concurrency at the client level, its much easier to handle it in the middle man
among other issues
but your scenario is valid, its just a lot more work to handle concurrency, among other things
true, unfortunately the company wanted a proof of concept without giving me any access to a server, then once I have the POC I can progress with setting up an authentication server and more.
I mean u can still write a POC with a backend without having access to the db
but either way is valid, its just more work the way your approaching it and more headaches
How so, the POC still requires displaying data from the database, I guess I more mean a MVP than a POC
oh dear, well at some point I'll aim to change it I think then
just need to show them what's possible, how it looks and then progress from there
wanted a proof of concept without giving me any access to a serverI understood this as u have 0 access to the db as well. But either way u can have the api (backend) running on the same machine of the app for demonstration purpose
oh no I have access to the database, just a read only version as I won't be updating any values just using it to display and export the data to excel
ohhh I see what you mean, that may be an idea
sure that is more than enough for the API I suppose
the beckend is mainly asp.net api
that leverages all the db access
so your WPF is a shell that obtain and fullfill data to the api
which in its turn save/query/w/e from the db
no, so the WPF literally just displays the data, has and will never have the ability to change any of the data
it does
I mean not with a readonly db
but it can
no but as in, the application I'm building will never need to, and they don't want me to
ah ok so its literally readonly
then yeah I can see it not needing a backend like this
yeah exactly, would definitely be using an API otherwise. It's just giving visibility to things that aren't visibile usually
there is no risk to lock anything
this looks fine then in this use case
nothing weird there unless you're using efcore and making repositories
with authentication being the only thing the API will be used for, where each user will have certain permission (Admin, and a list of objects they can see what's the best way to go about it with C#
that is a hard question it depends a lot on the app layout
some do ACL based, it also depends the granularity of access like if its just the menu options that would be limited of if say user A can access Orders and inside orders there are certain things they cannot see as in fields and whatnot
then it becomes more complex and involving
if the access granularity its not too complex it could be as simple as setting up datatriggers
So yeah itβs basically like user A can access one or many Orders, they select an order and can see a load of details on that order. The select menu displays only the orders they can see then I will have an admin account which can see all orders and create/delete/edit new accounts and assign them orders. My initial plan was just to have each account link to a list of order numbers and display from there. (User A can see order number 1, so when they go to select it filters all available orders with the order number 1 and only gives that option)
I mean u wont find anything tailored for that, u will have to wire things your self
specially if u dont have any rules already define of who can access what
like u said u would have to assign oders to a user as opposed to orders having certain access levels
that is not so common
normally if u have a sales rep, which sold order abc it would have a connection so it would make sense, but the way ur saying u would need to manually map already existing orders to users
I mean it shouldn't be too bad to map, the order number never change and new orders are rare (I'm using orders as the example it's not actually orders that I'm showing so they actually don't add new ones frequently at all). I was thinking of literally just having the UID stored, and sort the mapping of the UID's to the orders within the admin part of the application.
so the actual api would never map itself. and then when pulling data the SQL call used which define that the returned 'orders' must be in the array of ones they have access to which should mean that if an order isn't present it shouldn't affect anything
So for the API authentication ASP.NET is the best to go for, any packages you would suggest that takes some of the headache out of sorting the auth side?
Identity should be all, it also gives u roles etc
ok cool, and if I were to move into using the API to get the data this could be expanded to that without complications I'm guessing
u would use Identity if you're making an asp.net api
https://learn.microsoft.com/en-us/aspnet/core/security/authorization/secure-data?view=aspnetcore-8.0
I dont think you can standalone it directly in a WPF app
oh no sorry I mean, for now it will just be purely for authentication, but in the future if I wanted to also use it to supply data instead of accessing the database directly through WPF this would be possible?
the link above also mentions abou the create delete etc
yes
its just adding endpoints
oh yes that's perfect. Yeah sorry just only ever built apis in Python and JS
the concept is the same really, I mainly do in PHP
damn never touched PHP and hoping to not aha, what's it like compared to C#
eh its a cheap alternative that easily fits any hosting for the most part
I rather do it in asp.net if I can
but unhappily I dont always hold the decisions
ah yeah I feel you there. Was forced to use WPF because of this whereas was hoping to build it using Electron or Tauri but here we are
well at least you're learning xaml that is plus IMO
you can easily jump into MAUI, Avalonia, etc
Yeah true, it's actually not nearly as bad as I thought it was going to be
Is there any advantasges of Avalonia over WPF other than the cross platform capability?
it being heavily under development
customizing it being easier
it already have plenty of controls $avaloniauilibs
FluentAvalonia (Windows 11 inspired)
https://github.com/amwx/FluentAvalonia
SukiUI
https://github.com/kikipoulet/SukiUI
Material.Avalonia
https://github.com/AvaloniaCommunity/Material.Avalonia
Citrus.Avalonia
https://github.com/AvaloniaUI/Citrus.Avalonia
Aura.UI
https://github.com/PieroCastillo/Aura.UI
CherylUI (Mobile UI Library)
https://github.com/kikipoulet/CherylUI
Semi.Avalonia
https://github.com/irihitech/Semi.Avalonia
the look and feel being seamless between platforms
I would say its pretty young for mobile/web side of things but for desktop it has been very strong
does it work on older versions of windows like WPF does?
wait does WPF even work for windows 11?
how old we talking about? unsupported windows versions?
windows 8 and XP
should be just fine then
I don't think I have anyone using Windows 11 that needs the application, but I think a couple are using 7/8 and possibly XP
I mean 7 might run unsupported but beyond that...
how come 7 would run unsupported?
because no one supports EOL software?
https://github.com/AvaloniaUI/Avalonia/wiki/Runtime-Requirements/dc3da36338f0a3b3d917bd6d5f4307ae890a65f1
oh okay I see thanks
You're insanely knowledgeable man thank you
I wish, im no where close some of the dudes around here
I mean going the way you are you'll definitely get there. Thanks for responding so quickly every time π
if I close this chat do I lose the message history?
nope its stays but u might need to open the mmm thread thingy to actually see it
ah I see thanks π
either way after a few days of inactivity it automatically closes it self or hours I dont remember
oh I see