Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top