New .NET Core 3, NuGet and GitHub support

by abenedik 22. October 2019 16:17

I am pleased to inform you that some significant changes to our libraries have happened.

Everything started with the announcement that .NET Core 3 will support WPF and WinForms application. That meant that Microsoft would finally upgrade its frameworks that are used to create most of the desktop applications.

My first port to the beta version of the .NET Core 3 was very promising and it looked like that it will be easy to provide day-zero support for the new framework. But when the release day approached and when some additional tests were done, then some problems begin to emerge. Though the main functionality of the Ab3d.PowerToys and Ab3d.DXEngine libraries was ported without any problems, the existing licensing mechanism did not work with the new compiler. 

Our libraries use the standard .Net licensing mechanism that use license.licx files - in case when this file is present, the .Net compiler calls the licensing code inside the library during the compilation of the project. The licensing code can generate a run-time license key that is embedded into the project. This then allows to run the project on cumputers where the library is not installed. The problem was that the compiler for .NET Core 3 did not call the licensing code. This meant that it was not possible to use the existing licensing mechanism to provide commercial licenses. What is more, some tools (obfuscator) also did not fully support .NET Core 3 assemblies at the time of the release.

Therefore a new licensing mechanism was needed. Besides the support for .NET Core 3, one of the main goals of the new licensing was also to allow distribution with NuGet (without private repositories). This required that a single dll should be used for the evaluation and for the commercial version.

If you have checked our web site recently, you may have noticed that it was already possible to download beta and release candidate versions of the Ab3d.PowerToys and Abd3.DXEngine. The new libraries support .NET Core 3 and have a new licensing mechanism. And today I am announcing that final versions of both libraries were released on NuGet.

Let me quickly describe the new licensing mechanism. It is super easy to use. When the library is used for the first time, a "Start evaluation" dialog is shown. This allows the user to start a 60-day evaluation of the library. In evaluation mode, all the features of the library can be used. The differences between running in evaluation and commercial mode are that in evaluation mode sometimes an evaluation watermark is shown and a dialog to show remaining evaluation days is shown once per day.

To activate a commercial version of the library, you do not need to change the dll, but you simply need to call a SetLicense method and pass a company name, license type and license text as parameters. For example, to activate Ab3d.PowerToys library, you need to add the following line to your project (it should be called before any Ab3d.PowerToys code is used):

Ab3d.Licensing.PowerToys.LicenseHelper.SetLicense(licenseOwner: "[CompanyName]",
                                                  licenseType: "[LicenseType]",
                                                  license: "[LicenseText]");

 

The same method can also be used to extend the evaluation period.

Note that the license text is not the same as the license key that was used until now. The difference is that the license text also need to include information until when the updates for the library are available. This is needed because everybody has access to the latest version of the libraries. So the licensing code needs to prevent using a commercial version that was released after the updates subscription has expired. Unfortunately, this will require the change of the license text after each license renewal. But on the other hand, the licensing code is cleaner and the distribution of the dlls is much simpler and done in a much more common way for the .Net ecosystem.

Of course, the current way of distributing evaluation and commercial versions with windows installer will still be available and fully supported in the future.

One of the advantages of using windows installer was that with the dlls it was also possible to install the sample projects for the libraries. This is not possible with NuGet distribution.

Again, there is a more conventional way in the .Net ecosystem to distribute sample projects. It is GitHub. So, when a NuGet package is installed with the Nuget Package Manager, a readme file is displayed. And the readme file shows the user a link to GitHub repositories with sample projects.

Currently, the following two repositories are available (contain solutions for standard .NET framework and for Core 3):

https://github.com/ab4d/Ab3d.PowerToys.Wpf.Samples

https://github.com/ab4d/Ab3d.DXEngine.Wpf.Samples

 

I am planning to add more repositories in the future.

I am also planning to add NuGet support for Ab2d.ReaderSvg, Ab2d.ReaderWmf and Ab3d.Reader3ds libraries.

 

Now each version of the library comes with many different variants - commercial, NuGet, core 3, etc. How do you know which one is which? This can be read from the revision number. If it is below 1000, then it is an evaluation version that was installed with windows installer; if it is between 1000 and 2000 then it is a commercial version that was installed with windows installer; if it is above 2000 then it has universal licensing and is distributed through NuGet. Also, the framework version is encoded into the revision - the last 3 digits tell you: if they are 35, then the library is compiled with .Net 3.5; 40 means it is compiled with .Net 4.0; 45 means .Net 4.5 and 300 means .NET Core 3.

 

Let me finish with the following question: should a WPF project be ported to .NET Core 3?

Here I would agree with Microsoft's recommendation: if your project is already completed and require only minimal maintenance, then leave it on a standard .Net framework. If the project is still heavily under development, then it is worth considering to migrate to .NET Core 3 for one of the next releases of your project. If you are starting a new WPF project, then it is recommended to use .NET Core 3.

Tags: , , , , , , ,

Ab3d.PowerToys | DXEngine