In this first phase of modernizing the WPF version of .NETpad, we'll take the original project, apply Windows 11 theming, and make some other basic updates.
For those unfamiliar, .NETpad is my basic clone of Notepad, an update I created--and then recreated in various forms--while I was writing the Programming Windows series that I turned into the book Windows Everywhere. There are many versions, in different languages and app frameworks, but my favorite, by far, is the WPF version. And thanks to Microsoft's renewed interest in WPF this year, I've decided to modernize .NETpad so that it looks and feels more natural in Windows 11 and offers as many of the features Microsoft has added to Notepad in recent years as is possible.
And that's the uncertainty: I've spent the past three-plus months working on that to see what is possible. And while .NETpad isn't quite where I want it as I write this, it's in a much better place than it was when I published three versions of the .NETpad codebase to GitHub back in 2020. And so I feel that I can now document the process anyone can go through to take the code for the WPF version of .NETpad and start that modernization process for themselves.
Let's get started.
Prerequisites
The .NETpad modernization project requires .NET 9, which is in preview as I write this, and will ship in stable in November 2024. That means we'll need the preview version of Visual Studio 2022 (17.12) and the preview version of .NET 9 (Preview 7 at the time of this writing). Then, install the ".NET desktop development" workload when you configure Visual Studio.
Once Visual Studio is up and running and you've signed in, choose "Clone a repository" from the opening screen. You can find the repository location Visual Studio requires on GitHub. (Here's a direct link.) Review/configure the path, click "Clone," and let Visual Studio do its thing. When it's done, you can expand the "NotepadWPF" project name in the Solution Explorer pane to see all the files in the project. And then click the "Start" button (which has a green triangle and the text "NotepadWPF") in the toolbar to build and execute the app.
When you're done playing around with and noting how old-fashioned it looks, close the app. It's time to modernize it.
Update the .NET and app versions
The first step in this process is to upgrade the version of .NET the app uses from version 6 to version 9. To do so, right-click on the "NotepadWPF" project name in Solution Explorer and choose Properties. Then, in the project properties view that appears, locate "Target framework" near the top. Change it from ".NET 6.0" to ".NET 9.0".
Then, change "Target OS version" from "7.0" to "10.22000.0," which is for the initial version of Windows 11. This will change "Supported OS version" to the same version, which we'll leave as-is.
Scroll down until you find "Package version." This is currently set to 2.1.0. Change that to 3.0. Change "Copyright" to "2024 Paul...
With technology shaping our everyday lives, how could we not dig deeper?
Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.