At Connect(); 2018, .Net Core 3.0 Preview 1 was released and to support WPF/WinForms announced.
I’ve been owned two libraries that are ReactiveProperty and Livet. ReactiveProperty is targeted .NET Standard 2.0. .NET Standard 2.0 is available for .NET Core. However, Livet is targeted .NET Framework 4.5.2 or later. So, I have to convert it when I’ll use it on .NET Core 3.0. This article is working logs that I did.
Create a .NET Core 3.0 Class Library project that name is Livet.NetCore.
The project file that is generated is as below:
I changed the project file in order to support WPF. Changed the “Sdk” attribute at Project tag to Microsoft.NET.Sdk.WindowsDesktop, and then added “
After that, under the dependencies node of the project would change like below:
At Livet project, all of codes are in Shared project. So, I added reference to it on the Livet.NetCore project. If in your product there is no shared project, then at first you create a shared project, and then copy all code to there.
After that, a lot of errors occurred.
The errors were by to depend the behavior feature. I had to add a reference that is “System.Windows.Interactivity.WPF” manually, using NuGet package manager.
All compile errors was fixed! However, the package is targeted .NET Framework 4.6.1. Below warning occurred.
At “C:UsersUser name.nugetpackagessystem.windows.interactivity.wpf2.0.20525libnet40”, I checked compatibility using Microsoft API Portability Analyzer with below command:
path to apiport.exe folderApiPort.exe analyze -f .
The detail of ApiPort.exe is written on previous article.
On the report that is result of the command, there is green at .NET Core column.
I decided ignoring the warning. I added “NU1701” to NoWarn item of Properties window of System.Windows.Interactivity.WPF in order to ignore the warning.
Publish to NuGet
Final step is that publish to NuGet. It is very easy. Fill information to Package tab of project properties.
And then, select publish menu of project’s context menu.
After completed the wizard, would be generated a nupkg file. then upload to nuget.org.
I converted the class library that is targeted .NET Framework to .NET Core 3.0. In this class library, it was very easy, however if your product depends Windows specific features(ex: XBAP, Windows service, COM, etc…), then I think you will have to need additional steps.
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here