Linux: System.IO.Ports

I’m not sure if this is an OpenTap project issue or a dotnet bug.

System.IO.Ports installs and works properly in Windows. When compiling the project in Linux (Raspberian), the wrong version of System.IO.Ports is copied to the output directory.

I have tried changing the project framework and other settings in the csproj file to net6, but the wrong file (from netstandard2) still gets copied.

My solution is to manually copy the correct file to the output directory and my app works fine. Any idea if this is a OpenTap configuration issue or a Microsoft (dotnet) oversight?

Hi @craig.petku,

We don’t ship System.IO.Ports with OpenTAP, so you need to fetch it yourself and when you build you need to specify the exact platform. This way it will know which version of the package to get from

You need to specify the runtime identifier when building on Linux, otherwise you will get a DLL without any implementation.

If you add this to your csproj file it should download a version that works on Raspberian (assuming arm64):

        <PackageReference Include="System.IO.Ports" Version="6.0.0"/>

On Windows, we use .NET framework, which includes System.IO.Ports by default, so there you don’t need to specify those things.

Also, to avoid problems, I’d set up some condition statements in the csproj XML to control when the RuntimeIdentifier is set or not. And if you want to build tap packages, you would need to build platform specific ones.

1 Like