Skip to content

Consider using runtime checks instead of multi-targeting specific Unix distros in System.IO.Ports #54556

Closed
@ViktorHofer

Description

@ViktorHofer

System.IO.Ports currently targets Linux, OSX and FreeBSD even though their implementation is 95% identical. To reduce package size and build times runtime checks could be used for the 5% diverging functionality:

<ItemGroup Condition="'$(TargetsLinux)' == 'true'">
<Compile Include="System\IO\Ports\SerialPort.Linux.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.OSX.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsFreeBSD)' == 'true' ">
<Compile Include="System\IO\Ports\SerialPort.FreeBSD.cs" />
</ItemGroup>

As an example, when adding NetCoreAppCurrent configurations, the package grows disproportionally because of the amount of runtime specific assemblies.

cc @adamsitnik @carlossanlop @jozkee @jeffhandley @ericstj

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions