1

我想在我的 C# 项目中使用 Pcap.Net。我下载并添加对项目的 .dll 引用。

该项目成功构建,但是当我运行它时,出现以下异常。

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: 

我该怎么办?

4

2 回答 2

1

您可能没有在您尝试运行此代码的机器上安装一个或多个PCap.Net 要求。

这些要求(如PCap.Net 项目的本页所述)是:

  • WinPCap ;
  • .NET Framework 4.0或更高版本;
  • Microsoft Visual C++ 2010可再发行包。
于 2016-07-12T10:38:26.687 回答
0

无论您需要 x86 还是 x64,只需检查 .dll 的正确版本即可。或者根据您拥有的.dll 版本更改您的应用程序的平台目标。

于 2016-08-21T09:02:16.973 回答