Search code examples
c#.netlinux.net-coresharppcap

Nuget package referenced library has different names on Linux and Windows


I am working on small packet sniffer which will run on Windows and Linux. For sniffing packets I use SharpPcap. SharpPcap runs with no problems on Windows. On Linux there are some tweaks which are needed to be done to make everything working fine since Linux is not using Wpcap.dll but Libpcap.so and I am getting error/exception because wpcap dll/so was not found. Those tweaks depend on Framework I chose for project.

Linux(Ubuntu 18.04):

I installed libpcap with apt-get install libpcap-dev.

1. .NET Framework 4.6.1

Mapping wpcap to libpacap in SharpPcap.dll.config must be done. Then Running MyProject.exe with mono threws no exception and everything works fine.

2. .NET Core 2.1 project.

Library libpcap.so needs to be renamed wpcap.so then 'dotnet run' command runs project without problems and everything works fine.

In both approaches everything seems to be working fine but something doesn't feel right about their background. I am new in this kind of issues. Could you please help me to chose between those two or help me find some other way to make nuget package sharppcap working on both Linux and Windows?

Thank you


Solution

  • Library was updated and now works fine with Linux.