C# 在用户计算机上运行时,在上找不到System.IO.FileNotFoundException引用

C# 在用户计算机上运行时,在上找不到System.IO.FileNotFoundException引用,c#,dotnetzip,C#,Dotnetzip,我正在用Visual Studio Express 2013制作一个C#程序。我正在使用Ionic.zip(dotnetzip)。当我从…/bin/release目录或VisualStudio运行它时,它运行得非常好。当最终用户在他们的计算机上拥有它,或者我从另一个位置运行它时,当它尝试使用ionic.zip执行操作时,它会崩溃,出现以下异常 System.IO.FileNotFoundException: Could not load file or assembly 'Ionic.Zip,

我正在用Visual Studio Express 2013制作一个C#程序。我正在使用Ionic.zip(dotnetzip)。当我从…/bin/release目录或VisualStudio运行它时,它运行得非常好。当最终用户在他们的计算机上拥有它,或者我从另一个位置运行它时,当它尝试使用ionic.zip执行操作时,它会崩溃,出现以下异常

System.IO.FileNotFoundException: Could not load file or assembly 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c' or one of its dependencies. The system cannot find the file specified.
File name: 'Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c'
我完全不知道如何解决这个问题,在过去的3天里一直在研究如何解决这个问题,但没有成功。任何帮助都将不胜感激

谢谢,
James

首先将该文件包含在您的资源中,然后将其包含在其属性中:

  • 选择构建操作->内容
  • 复制到输出目录->复制(如果更新)

我附上一张照片。现在,您可以按如下方式访问其正确路径:

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Resources\\yourfile.exe";

检查依赖项-直接或可能是未安装的框架引用。如果assemblz位于搜索路径中,则应找到If。

您需要安装程序或脚本将DLL复制到执行目录(可执行文件所在的目录)或计算机路径中

除了自动搜索程序启动所在的文件夹。谢谢。这太完美了。我假设引用的dll已打包到exe文件中,但:/