It Takes More Than .NET 5 to Make WPF Current
by The Inedo Team, on Dec 11, 2020 10:58:15 AM
The release of .NET 5 gives us an updated version of Windows Presentation Foundation (WPF). Unlike Web Forms or the Windows Communication Foundation (WCF), Microsoft brought this .NET Framework technology into .NET 5+, giving it a new life.
You may have your WPF application on .NET 5 already. Or maybe you’re considering making one. WPF has already benefited from moving to .NET 5, and your applications will have an edge compared to those still on .NET Framework.
But just because your application is on .NET 5 doesn’t mean it's following the most important .NET 5 best practice: fast release cadence.
Your release cadence is the pace you push out updates for your application. It’s often a major focus for web-application developers, but WPF developers should give it some thought as well. A fast release cadence is not simply a set of tools; it’s a mindset that can be adopted by any developer. That being said, .NET 5 does have tools to help improve your release cadence, and it’s worth learning what they are.
In this article, learn:
How WPF Benefits from .NET 5+
If you are looking at creating a new WPF Application, you should target .NET 5.
.NET 5 already has benefits that let it surpass the .NET Framework version.
Benefits of .NET 5+ and Their Application to WPF
|.NET 5+ Benefit||Application to WPF|
|Continued innovation||✓ Microsoft has already added features for WPF on .NET 5 not available for .NET Framework. If you want the most up-to-date, feature-rich version of WPF possible, .NET 5+ is the way forward.|
|Improved performance||✓ WPF can benefit from some performance changes made in .NET 5, specifically those provided by trimming, meaning a smaller application size|
|Tools for releasing applications (mainly increasing release rates)||⚠️ Releases can be aided with .NET 5, but require effort. A fast release cadence is a mindset that can be aided by technologies, not just a technology. .NET 5 has added tools to assist with faster releases, but you will have to enable them yourself|
Of these three benefits, you can take advantage of two of them with minimal work. To benefit from continued innovation, you simply use new features. The performance benefits simply require your application to exist on .NET 5.
To take advantage of new tools for releasing applications though, you will have to rethink how you build your application. A good way to start is considering how you deploy your application.
Rethinking Your Release Cadence for WPF with .NET 5+
If you are using WPF with .NET 5, now is the right time to consider how you deploy your application—especially if you are using a legacy MSI installer. While much of the buzz around .NET 5 has been around improving releases for web applications, Microsoft has brought along some desktop deployment options as well. .NET 5 supports ClickOnce and MSIX deployments, both options worth considering for WPF developers looking to increase their release cadence.
Microsoft brought ClickOnce into .NET 5 as a deployment option for WPF developers. It is possible that you already use ClickOnce, as it was originally a .NET Framework technology. But if Microsoft thinks it is a good enough deployment strategy, it's worth considering.
|Maintenance||Easy. ClickOnce simplifies deployment for developers because it does not require you to maintain a separate project for your installer.|
|Automatic updates||Reliable. No user will miss a release. Every time the application is launched, it checks for an update. If an update is available, it prompts the user to start the install process.|
|Unattended updates||Not Possible. ClickOnce still requires the end-user to update the software. There is no way to automate the install process while the application is not in use. Realistically, this is only an issue if your application takes a long time to download and install.|
|Administrator permissions||Not Possible. If your application requires administrative permissions, it is not designed to work with ClickOnce. You will need to find another solution.|
|Flexibility||Low. ClickOnce is meant to work one way: the user clicks the application and starts the install process. One-click updates are the only option.|
MSIX was introduced in 2018, designed to make deployment easier for Windows 10 desktop applications (although it can work with Windows versions as early as Windows 7 SP1). It can either allow for automatic updates or a deployment that looks similar to ClickOnce. The automatic deployment is the exciting feature, as it enables developers to release updates without any user intervention.
|Maintenance||Difficult. The main difficulty with MSIX is that it requires you to make a separate application. Instead of one application, you have two.|
|Automatic updates||Reliable. You can set your application to check for updates on launch or the same way an application from the Windows Store would. Either way, users are not missing updates.|
|Unattended updates||Possible. MSIX allows automated updates the same way an application from the Windows Store would. You can set an interval where the application checks for a release and automatically installs the update.|
|Administrator permissions||Possible. You can create applications that require admin permissions as well as applications that do not.|
|Flexibility||Medium. It is more flexible than ClickOnce. You can start an update on application launch or as an automated background process when the application is closed. But MSIX has potential issues that keep it from working in all circumstances.|
DIY: Consider Building Your Own
If you cannot find one that covers all your requirements, create your own deployment solution. This route requires some seasoned desktop application developers and maintaining a separate project. Nothing is guaranteed with a custom deployment solution, as you have to create every feature from the ground up. But this route is by far the most flexible.
|Maintenance||Difficult? The initial lift will be a challenge for sure. You are building an application from the ground up. But it is possible to build a deployment solution that is easier to maintain than MSIX.|
|Automatic updates||Reliable, with effort. If you want automatic updates, you must add that feature yourself.|
|Unattended updates||Possible, with effort. If you want unattended updates, you must add that feature yourself.|
|Administrator permissions||Possible, with effort. If you want Admin Permissions, you must create those requirements yourself.|
|Flexibility||Unlimited. You can build a simple tool that just copies some files, or an installation center for a whole suite of applications. What the deployment solution does is totally up to you.|
Many applications that went the Do-It-Yourself route built their own custom installation centers, like Google Chrome, Adobe Creative Cloud, and our own Inedo Hub. Each of these deployment solutions has slightly different priorities:
- Google Chrome uses Google Update for enterprise users on Windows. It allows for consistent, automatic updates for the Google Chrome Browser and Google Chrome Apps across many computers. It includes many additional customizations to give you more control over how and when updates are applied.
- Adobe Creative Cloud is designed to manage the installation of a whole suite of software and allow users to update many applications at once for an individual machine. Additionally, it acts as DRM. It detects active logins for the account and controls software access based on their license.
- The Inedo Hub is our custom deployment solution. Its primary purpose is to help customers install, update, and manage all their Inedo applications in one spot. It also checks user license details and allows users to install prerelease builds.
These are some of the features these deployment solutions have that you can’t do with ClickOnce or MSIX:
- Manage installations for a whole suite of software instead of just one application.
- Allow users to select specific update rules and specific versions of the software.
- Act as a form of DRM with license requirements or login limitations.
- Monitor the status of installed programs and report back to a central location
- Provide diagnostics on installed programs to users to repair common problems
- Automatically install new applications that the user doesn’t have installed
The main draw of making your own deployment solution is that you can create exactly what you need. Whether that’s a deployment that maintains the installation of multiple applications, manages licenses, allows beta release access, requires administrative access, or simply moves files, is up to you.
Which Option Should I Choose?
|Automatic updates||Reliable||Reliable||Reliable, with effort|
|Unattended updates||Not possible||Possible||Possible, with effort|
|Administrator Permissions||Not possible||Possible||Possible, with effort|
Which option works best depends on what is important to you. These are some general guidelines:
- ClickOnce is your best bet if you want a deployment option that is easy to maintain.
- MSIX is a viable option if you want unattended updates, require admin permissions, and don’t mind the additional project.
- Consider a Do-It-Yourself option if you have multiple applications or other needs that can’t be addressed by ClickOnce or MSIX.
No matter what you choose, a faster release cadence requires a mindset, not just a new technology.
How to break software into microservices/micro-applications, whether to adopt a full CI/CD deployment strategy, and so forth are topics that deserve considerable research and discussion. .NET 5 has deployment options that allow a faster release cadence for your WPF application but increasing your release cadence will require a cultural change too.
WPF on .NET 5+ Works Well but Doesn't Solve Everything
Running your WPF application on .NET 5+ will be easy for many developers and provide a better experience than .NET Framework. Microsoft has already made new features for WPF, and there are likely more improvements on the way.
But .NET 5 won’t solve all your issues. Deployment is still a tricky problem to solve. Even with .NET 5, finding the right solution for your application will take some significant effort.
What .NET 5 provides though, is an opportunity to make changes you wouldn’t consider otherwise. Whether changing your deployment strategy to increase your release cadence or tackling some other challenge, now is the time to look at modernizing your applications.
We’re building a guide to help you successfully navigate the migration to .NET 5 and beyond. Sign up today to get early access and to share your own feedback and input.