0

I am making a program in C# with Visual Studio Express 2013. I am using Ionic.zip (dotnetzip). When i run it from the .../bin/release directory or from Visual studio, it runs perfectly fine. when the end user has it on their computers, or I run it from another location, when it tries to perform an action using ionic.zip, it crashes with the following exception

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'

I have absolutely no idea how to fix this, and have been researching for the last 3 days how to with no success. Any help will be appreciated.

Thanks, James

therimmer96
  • 23
  • 1
  • 6

3 Answers3

1

CHeck dependencies - either directly, or possibly a not installed framework reference. If the assemblz is in the search paths if should be found.

TomTom
  • 61,059
  • 10
  • 88
  • 148
0

First include that file in your resources after that in its properties:

  • Select Build Action -> Content
  • Copy to Output Directory -> Copy if newer

enter image description here

I am attaching a picture. Now you can access its correct path as follows:

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\Resources\\yourfile.exe";
Syed Farjad Zia Zaidi
  • 3,302
  • 4
  • 27
  • 50
0

You need to have an installer or script copy the DLL to the executing directory(where the executable is) or into the computers PATH.

Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41