简体   繁体   中英

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

库已更新,现在可以在Linux上正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM