# MMClient Project modernization and .NET 6 Feasibility * Actions taken * Build on clean modern dev environment * Dependency analysis * Project conversion * Major building blocks for modernization * Action plan and .NET 6 portability ## Actions taken Assessed the current project for modernization steps and .NET 6 compatibility: * Set up clean dev environment using Windows 11 and VS 2022 (virtual dev environment provided by Microsoft) * Check project compatibility and fixed build issues * Analyzed third-party dependencies for .NET 6 compatibility and project status (is the project still actively maintained?) * Updated project to new .NET style project format (SDK format) and PackageReference format * Run .net6 upgrade tool to get a first idea of upgrade implications * Worked out action plan for further modernization ## Build on clean dev environment Tried to build current project on clean, modern dev environment (Win 11, VS 2022). Main findings: * Some dependent libs are targetted to .NET 3.5 and 4.0. No development targeting packages are available anymore, such that these components needed to be retargetted * **WPFToolkit**: replaced static DLL by nuget package with latest version: https://www.nuget.org/packages/DotNetProjects.WpfToolkit.Input/ * Had to make some small modifications in Trend to get it working * **SQL Server Compact Edition**: Replaced by latest NuGet package, worked fine * **Other libs** see dependency analysis below * Some libs targetted to .NET 4.8 and 4.5.1 require installation of development/targeting package, upgrade recommended * Needed to install .NET Core 3.1 runtime for some libs (should smoothly update to newer .net versions, as .NET Core is more modern than .NET Framework) ## Dependency analysis | Lib | Comment | .NET6 compatible? | Dependant projects | |--- |--- |--- |--- | | **WpfToolkit** | *can be replaced by latest version from nuget (Trend uses some incompatible style properties) | Yes* | Graph, Trend, Profiles (and depending projects) | | **CanonicalSplineLib** | Retargeted to 4.8, Must try to retarget to net 6, no official build available | Probably portable | Trend | | **KMLib** | Retargeted to 4.8, .net 6 unsure, probably | Probably portable | GlobeControlLibrary **DocumentPreview** | Not in use (commented code) | Unrequired | StoryView, DecisionMaker **PdfSharp-WPF** | Used for extracting images from PDFs, nuget package available, no special dependencies | Very likely | PrintedPressLibrary **RTFLib** | Used for building rtf documents, no nuget package, maybe find replacement | Probably portable | ReportEditor **RtfParserLib** | Used in Rtf Helpers, nuget package NRtfTree-library, no special dependencies | Very likely | Common **StarRatingsControl** | Maybe portable to NET6, possible replacement: GitHub - BratchedDev/Bratched.Tools.RatingControl: a complete xaml rating control | Maybe | DecisionMakerApp, ProfilingApp, OsinfiEditor, Reporteditor, Searchresult **Vlc.Net** | Could be difficult to port, possible replacement: LibVLCSharp.WPF by VideLAN from nuget | Maybe (libvlcsharp: yes) | Video **CEF** | Embedded chromium (not available for .net 6), Though an issue on github says it is .net 6 compatible, possible replacement: WebView2: embedded edge, easier integration, no runtime installation necessary, always up to date with windows updates | Needs a try | WebViewer, Profiles, etc.... **DevExpress** | *Could require big refactoring to adapt to latest version, available for .net 6 with latest versions | Yes * | many **WPF3DLib** | Our own implementation ? | | Vita, Globe, … **Lucene.Net** | Nuget available | ? | DM, Profiles, Trend **3DTools** | Nuget available | Seems so | Vita **HtmlAgilityPack** | Nuget available | yes | Profiles **ICSharpCode.SharpZipLib.dll** | Nuget available | Very likely | FeedexerConnector **Ionic.Zip** | Nuget available | Very likely | Globecontrollibrary **Microsoft.Prism and Unity** | Nuget available, *might require big refactoring to go to latest version | Yes * | All (basic dependency injection framework) **SlimDX** | DirectX library for globe, no longer maintained, nuget available, possible replacement: SharpDX, also out of maintenance, but netstandard compatible | ? | GlobeControlLibrary **System.Datsa.SQLite** | Used by some iphone location source class, nuget available | Yes | ExternalDataSource **WpfDataObjectExtensions** | Possible replacement: ModernWpf.Toolkit.UI from nuget | ? | Many **WPFExtensions** | Nuget available | Very likely | many **WPFLocalizeExtension** | Nuget available | probably | many **XAMLMarkupExtensions** | Nuget available | probably | Many **Antlr4.Runtime** | | yes | **FubarCoder.RestSharp.Portable** | | yes | **JsonSubtypes** | | yes | **Microsoft.AspNet.WebApi.Client** | What for??, AspNet should be avaialbe for .net 6 | Yes* | SystemDefinitionLibrary **Microsoft.SqlServer.Compact** | Nuget available | yes | **NAudio** | already nuget | very likely | Dictation **Newtonsoft.Json** | already nuget | yes | **Nito.AsyncEx** | already Nuget, used for async tasks, probably replaceable | unsure | Profiles **NLog** | Nuget, maybe adaptions needed (sometimes dll directly referenced) | yes | **System.Data.DataSetExtensions** | already nuget | yes | **System.Windows.Interactivity.WPF** | nuget | probably | Graph ## Major building blocks for modernization ### Microsoft Prism/Unity Prism/Unity is used as base layer for the whole application, providing Dependency Injection and Module system. Can be updated to newer version with NuGet Dependency management. Some adaptations are needed. On a first quick try, I stumbled over some incompatibilities (Interception lib) that weren't obvious to resolve. But they should not be a blocker. ### DevExpress DevExpress has .NET 6 compatibiliy starting with version 21.1. Latest version 22.2. I made a quick try to convert the Common project to the latest version. Common project provides some common UI views, that are based on DevExpress but doesn't depend on any other libs with DevExpress dependencies, so I could port it independently. The port was suprsingly easy and smooth, which makes me positive about porting the whole app. I expect some incompatibilities with more complex components, e.g. RichEditor and Scheduler view. Note, that we should validate whether our custom patches are still required. Some have already dropped out in later releases. Maybe we can use DevExpress vanilla. ### Chromium Embedded Framework CEF has no support for .NET 6 yet, though there are some claims in the issue tracker on GitHub stating that it works. However, I would recommend to replace it with the new WebView2 which is integrated with WPF. It is an embedded Edge (Chromium), and doesn't require installation of a runtime (if installed on Windows). It replaces the old WebView, which embedded Internet Explorer and was therefore unusable for us at that time. WebView2 seems also to have support for .Net Framework 4.5 and later. ### VLC.NET embedded video player Seems to be out of maintenance. It's very likely the existing project can be upgraded to .NET 6. However, my recommendation is to look into libVlcSharp from VideoLAN themselves, which is also mentioned on the VLC.NET project page as a good replacement. Also, we could investigate, whether the built-in video element of WPF is suitable now. There were reasons why we switched to VLC (codec support, or likewise and multiple video player instances in one view), which I don't fully remember. ### DirectX bindings (SlimDX) 3D components like Globe and Vita use SlimDX as DirectX bindings for .NET. The project is dead. A possible replacement is SharpDX. I think, there is a chance, the current SlimDX library can be reused also in newer .NET version, and may not require a replacement at all. # Action plan and .NET 6 portability To modernize the build project and get closer to .NET portability, I suggest the following action plan. The modernization steps are probably a good idea even if we don't ultimately go to .NET 6. We may skip some steps and stick to .NET Framework 4.8 for now, depending on how far we can proceed. 1) Convert projects to new SDK and PackageReference format (**Done**) * Some nested projects made problems because of inclusive nature of new csproj format 2) Replace most dependencies by nuget packages (dependency management) if available * Also: use DevExpress NuGet url with api key (if no custom patches are required) 3) Update dependency versions * Smaller libs should be smooth to upgrade * See above for suggestion about major dependency upgrades: * Microsoft Prism framework * DevExpress * Embedded VLC * Embedded Chromium (CEF) * DirectX bindings 4) Update to .NET 6 * After above dependency update, .NET 6 upgrade could be a low hanging fruit ## Appendix ### Most interesting output from .NET upgrade-assistant: May or may not be relevant if .NET update is performed: ``` Diagnostic UA0013_D with the message Although ClickOnce is supported on .NET 5+, apps do not have access to the System.Deployment.Application namespace. For more details see https://github.com/dotnet/deployment-tools/issues/27 and https://github.com/dotnet/deployment-tools/issues/53 generated VitaControlLibrary Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated SystemDefinitionLibrary [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:19 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated Trend [17:02:12 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:12 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated Graph [17:02:07 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated StoryViewLibrary [17:02:00 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:00 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:00 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:00 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:02:00 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated GlobalCommands [17:01:59 INF] Diagnostic UA0013_L with the message Windows Forms Deprecated controls : ContextMenu needs to be replaced with ContextMenuStrip. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:01:59 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:01:59 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated [17:01:59 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated StoryView [17:01:58 INF] Diagnostic UA0013_P with the message Windows Forms Deprecated controls : MenuItem needs to be replaced with ToolStripMenuItem. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated […] Common [17:01:25 INF] Diagnostic UA0013_M with the message Windows Forms Deprecated controls : DataGrid needs to be replaced with DataGridView. For more details see - https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms#removed-controls generated […] ```