- Author: Damian Suess
- Date: April 12, 2022
This document outlines the steps needed to upgrade the SDK, ThingMagic Mercury API v1.35.1, from .NET Framework v3.5 to .NET Standard so that it can be cross-platform compliant. After performing the upgrade, the SDK was sucessfully tested on Linux (Ubuntu 22.04 LTS) using .NET 5 and .NET 6.
Previously, the C# Mercury SDK using the deprecated .NET Framework, only allowing it to run on Windows.
We will be using the TingMagic IZAR 4-Port UHF
Common Language - Mercury API, ThingMagic’s universal programming interface, permits easy software portability across the entire ThingMagic product line – between finished readers and embedded modules.
The latest JADAK ThingMagic Mercury API is, v1.35.1.
WARNING:
Though it states states it support .NET Core, the SDK files such as
LLRP.dll
are written for .NET Framework 3.5.
The Universal Reader Assistant is the application used by Jadak for testing out their various devices. (i.e. the same one Jeff is using).
Jadak SDK\Software\mercuryapi-1.35.1.103\cs\Samples\UniversalReaderAssistant2.0
In LLRP's LLRPClient.xslt file is missing a reference to the event, public event delegateGenericMessages OnGenericMessageReceived;
. During compile-time, LLRPClient.cs is generated from the XSLT template which does not contain infrastructre required by the ThingMagic.Reader project.
The MercuryAPI.dll requires the open source project, LLRP.dll, which is built on .NET 2.0.
This document provides the outcome of the feasibility to upgrade the library to .NET 5 and its ability to run on Linux. Overall, I would prefer the 3rd-party vendor to perform this action for supportability and warranty purposes.
The upgrade was successful.
The following steps upgrade the SDK to use .NET Standard so it can to work .NET 5 and with the legacy .NET Framework.
The upgrade was performed using Microsoft's tool, try-convert
and the following outcomes were discovered:
Add NuGet Package References:
Microsoft.Build.Framework
Microsoft.Build.Utilities.Core
.
Update CodeGenerate.csproj
to include IsImplicitlyDefined="true"
to take care of the following error message:
The package reference Microsoft.Build.Framework should not specify a version. Please specify the version in 'xxx\Packages.props' or set VersionOverride to override the centrally defined version.
<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="17.1.0" IsImplicitlyDefined="true" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.1.0" IsImplicitlyDefined="true" />
</ItemGroup>
Unfortunately, <ProjectGroup>
with <AllowPackageReferenceWithVersion>true</AllowPackageReferenceWithVersion>
doesn't work.
Add NuGet package, System.Configuration.ConfigurationManager
<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" IsImplicitlyDefined="true" />
</ItemGroup>
After upgrading to .NET 5, <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
, is removed. This is because it is a .NET Framework 4 library.
MSBUILD BUG:
Due to the bug 1680, [dotnet/msbuild#1680], the BeforeBuild and AfterBuild targets are longer working in .NET Core projects. MSBuild is overriding these targets with the default SDK target file. You must use,
BeforeTargets="Build"
as a workaround.
- The LLRP project makes a reference to the deprecated library,
System.Runtime.Remoting
. This library is no longer supported due to its problematic architecture, and is no longer supported. Ref - Suggestion: An upgrade to use,
System.Net
andSystem.Net.Sockets
is recommended. TCPIPClient.cs
relies on the deprecated library and needs upgradedLLRPClient.xslt
and.cs
references it but is not used.LLRPEndPoint.xslt
and.cs
references it but is not used.
Also known as, MercuryAPI, ThingMagic.Reader was originally built using .NET Framework 4.0. This section documents it upgrade path to .NET 5
- System.IO.Ports - Deprecated. use the .NET Platform Extension 6