NyxSql - a journey from .Net Framework to .Net 6 - Part I

Search for a command to run...

No comments yet. Be the first to comment.
Just a very short blog post... for everyone who is not yet known to it. Since .Net Framework 4.6 for two immutable types we got new static fields in the framework: Array.Empty<T> string.Empty // instead of string foo = ""; byte[] bar = new byte[0...

Introduction In one of my older projects, I often had to synchronize and work with different parallel threads. Using async, parallel or 'real' threads does not make a real difference when it is coming to thread safety. As a very short short instructi...

In part III we take a closer look at where to upgrade our UserInterface from WindowsForms. As NyxSql was created as a learning project more than a decade ago, there is no MVVM or anything else implemented, which will make the upgrade more hard as the...

When using package manager with sources which require to authenticate yourself (e. g. internal sources or paid subscriptions), it may happen that you need to change your password or just entered the wrong credentials. Now, it is kinda like 'evil', be...

When working with multiple workstations (workstation / laptop) due to pandemic, we suddenly experienced the following error when opening solutions: Current solution contains incorrect configurations mappings. It may cause projects to not work correct...

In this series, I will write about upgrading a project which was created on .Net Framework 2 to .Net Core. All steps will be included, as in pushing to a fresh github repository and every major step of the migration.
At first, the name was inspired by Nyx. I decided to write this program over a decade ago, due to the lag of universal sql editors / gui tools from windows to most common databases. It was intended to be a learning project using WinForms. As I mainly used it for Oracle database it was abandoned by me when SqlDeveloper was released.
Currently I created a private git repository at GitHub. Perhaps I will make it public at some time, but due to bad experiences with projects, which had been completely cloned and used without any credits, I am keeping it private right now.
After git was pushed and all files in place, I opened the solution with Visual Studio. The very first question which came was the 'Target framework not supported', where the upgrade to 4.8 was confirmed.
Afterwards a whole batch build and installation of odp.net.managed nuget package. Then NyxSql started without any further complains! As happy as I was about the successful start, as ugly is the GUI.. but we will have another article about that.
For upgrading from .Net Framework or .Net Core to .Net we can use the .net upgrade assistant from Microsoft. I personally prefer to visit the github project page directly.
Now we require a command prompt (cmd) or powershell for executing the following commands.
Installation:
dotnet tool install -g --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources upgrade-assistant
or if it is already installed, the update:
dotnet tool update -g --add-source https://api.nuget.org/v3/index.json --ignore-failed-sources upgrade-assistant
Open a powershell and change to the project directory, e.g.:
sl d:\source\c#\NyxSql
Then we start the upgrade with:
upgrade-assistant upgrade --skip-backup --non-interactive Nyx.sln
Where we use:
After the upgrade is finished, you should analyze the output for warnings. When upgrading NyxSql we got for example following warnings:
[20:18:16 WRN] Default font in Windows Forms has been changed from Microsoft Sans Serif to Seg Segoe UI, in order to change the default font use the API - Application.SetDefaultFont(Font font). For more details see here - https://devblogs.microsoft.com/dotnet/whats-new-in-windows-forms-in-net-6-0-preview-5/#application-wide-default-font.
[20:18:41 WRN] No version of odp.net.managed found that supports ["net6.0-windows"]; leaving unchanged
[20:18:43 WRN] HighDpiMode needs to set in Main() instead of app.config or app.manifest - Application.SetHighDpiMode(HighDpiMode.<setting>). It is recommended to use SystemAware as the HighDpiMode option for better results.
[20:19:02 WRN] Manual updates needed to address: UA0013_M@SourceFile(d:\source\c#\NyxSql\Nyx\Tools\UserSettingsManager\DisplayProperty.cs[1462..1470)): 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
Next to the solution Nyx it was also required to update NyxUpdate.sln in another step.
In the next article we will look at how to create plain project files and if we can run the project.