A few months ago, we looked for a challenge.
That tweet generated a lot of responses. The most vocal of them was – make NuGet Package Explorer (NPE) run on the Web. To date, NPE has been downloaded over 250,000 times, so this was exactly the challenge we looked forward to. The stakes were high but if successful, we would have contributed something of real value to software developers.
We worked with Claire Novotny, the maintainer of original Windows NPE built with WPF on .NET 6, and we present to you:
https://NuGet.info
The new solution is a WinUI, Windows Community Toolkit and Uno Platform powered solution which runs on the Web, via Uno’s support for WebAssembly and .NET 6 for WebAssembly. As Uno Platform has built-in Progressive Web App (PWA) support, you can also install NPE as a PWA, and soon all other target platforms Uno Platform supports, depending on your needs and desires.
Next Steps
The NPE project has been a part of .NET Foundation and our contribution – NPE on the Web – will continue to be maintained under .NET Foundation mandate, and under MIT open-source license.
This version of NPE implementation is just the first iteration– extending the Windows implementation to the Web. Together with the community, we would love to make further improvements in UI/UX, functionality such as creation and edition of packages, using alternate feeds, signing packages, etc. We invite you all to contribute to make this an even more valuable tool for developers.
Our goal was to challenge ourselves, while create a tool which will be used by developers to make their lives easier. If you can make a case for using NPE on a mobile device and are willing to help create that unique mobile experience, we want to hear from you, so we can join forces. Or if you feel strongly about that native application on Linux or Mac, let us know.
The current WPF implementation of NPE will remain in the Windows store indefinitely, or at least until the new version fully replaces its functionality.
Technical Implementation
Being an MVVM application for WPF, the structure of the application lends itself well to being reused in slightly different context.
It is composed of a types (entities) project, and a View Models projects. Those two projects were already using cross-targeting (thanks Claire!), for which we only needed to add a .NET WebAssembly compatible target framework. Aside from the specifics of Windows PDB reading (portables PDBs are well supported!), certificate validation operations that are not supported on .NET for WebAssembly, as well as CORS considerations for downloading files, the rest of those two assemblies are the same as in the WPF app.
For the user interface layer, we created a new set of heads compatible with Uno. Those projects are referencing, through shared projects, many of the WPF converters that can be reused and shared as-is (with a bit of #if considerations), as well as many of the ComponentModel.Composition enabled services. We were also able to port lots of the XAML from the WPF app.
The new NPE Web Application is running on .NET 6 and uses many of the WinUI and Windows Community Toolkit controls, like Fluent Styles, TabView, Expander, TreeView, DataGrid, and others. It also supports local file reading of nupkg, snupkg, nupsec. The visualization of text files is done through a WebAssembly port of the Monaco editor originally developed for Windows by Michael Hawker.
The NPE Web Application is also a PWA that you can install on your favorite operating system and should provide you with a nudge when visiting nuget.info.
About Uno Platform
For those new to Uno Platform – it allows for creation of pixel-perfect, single-source C# and XAML apps which run natively on Windows, iOS, Android, macOS, Linux and Web via WebAssembly. Uno Platform is free and Open Source (Apache 2.0) and available on GitHub.
About NuGet Package Explorer (NPE)
NuGet Package Explorer (NPE) is an application that makes it easy to create, explore, and validate NuGet packages. You can load a. nupkg, .snupkg, or .nuspec file from disk or load a package directly from a feed such as nuget.org.
In Closing
We hope you enjoy the new NPE and that you will find time to contribute to it. In the meantime, you can also familiarize yourself with Uno Platform through our 3-min getting started tutorial.