Why all the extensions in the .NET Core version of JNBridgePro?
If you’ve looked at our new .NET Core components for JNBridgePro, you’ve probably noticed that there are a lot of new DLLs with names like Microsoft.Extensions.Configuration.dll. What’s up with that?
In addition to creating a platform that would work equally well on Windows, Linux, and MacOS, one of the goals of .NET Core was to create a very lightweight runtime that only had the necessary facilities: .NET’s “core,” if you will. Anything else that you might need would be provided as “extensions” that could be downloaded as NuGet packages that could be incorporated in the application. Some of these extensions would run on all OS platforms, and others might only run on one or two. In the case of JNBridgePro’s support for .NET Core, the only thing we need that isn’t part of the core APIs are the APIs needed to support configuration. Since we implemented configuration using JSON files, we need the following extension packages:
- Microsoft.Extensions.Configuration.Abstractions
- Microsoft.Extensions.Configuration.Binder
- Microsoft.Extensions.Configuration.Json
These packages are required by our .NET Core implementation of jnbshare.dll, and we downloaded them into the development environment using NuGet.
Jnbshare.dll also needs these extensions at run time, so they have to be in the folder with your application and with jnbshare.dll. In developing your application, you have to make sure they’re there. You can download them into your application using NuGet as part of the development process. As an alternative to doing that, we’ve supplied the relevant DLLs from the extensions, and you can simply include them with your application:
- Microsoft.Extensions.Configuration.Abstractions.dll
- Microsoft.Extensions.Configuration.Binder.dll
- Microsoft.Extensions.Configuration.dll
- Microsoft.Extensions.Configuration.FileExtensions.dll
- Microsoft.Extensions.Configuration.Json.dll
- Microsoft.Extensions.FileProviders.Abstractions.dll
- Microsoft.Extensions.FileProviders.Physical.dll
- Microsoft.Extensions.FileSystemGlobbing.dll
- Newtonsoft.Json.dll
- System.Runtime.CompilerServices.Unsafe.dll
Just make sure these DLLs are in the same build or deployment folder as jnbshare.dll. To guarantee that they’re always part of the build, in the Visual Studio Solution Explorer, right-click on the application’s project node and select Add → Existing item…, then select all of the above DLLs to add them to the project. Then, in Solution Explorer, select all the DLLs in the list above, either together or one at a time, right-click on the selected files, and select Properties. In the properties pane, in the “Copy to Output Directory” property, select “Copy Always.” Then, when you build your project, the files will always be copied to the build folder.
We realize that, whether you download the packages using NuGet or explicitly add the necessary DLLs, these may be more additional actions than you want to perform, so we’re looking ways to package the required functionality so that you don’t have to do this. Hopefully that will be included in a future version.
See more about our support for .NET Core.
As always, do let us know if you have any questions, comments, or suggestions for new features.