Вопрос

I want to use Pcap.Net in my C# project. I download and add .dll references to the project.

The project builds successfully but when I run it, the below exception occur.

System.IO.FileNotFoundException was unhandled
  Message=Could not load file or assembly 'PcapDotNet.Core.dll' or one of its dependencies. The specified module could not be found.
  Source=trafcon
  FileName=PcapDotNet.Core.dll
  FusionLog=""
  StackTrace:
       at ObtainingTheDeviceList.Program.Main(String[] args)
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

What do I do?

Это было полезно?

Решение

You probably didn't install one or more of the PCap.Net requirements on the machine where you're trying to run this code.

These requirements (as stated in this page of the PCap.Net project) are:

  • WinPCap;
  • .NET Framework 4.0 or higher;
  • Microsoft Visual C++ 2010 Redistributable Package.

Другие советы

Just check the correct version of .dll whether you need an x86 or x64. Or change the plateform target of your application according to the version of .dll you have.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top