C# - exporting a project that uses a DLL?

I am trying to grab the .exe for sharing my C# console application from "obj\x86\Debug", where I find a myProgram.exe file.

When I call this from the command line, I get the following error:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
 'ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73' or one of its dependencies. 
    The system cannot find the file specified.
           at Project.MyClass..ctor(String arg1, String arg2)
           at Project.MyClass.Main(String[] args) in C:\Project\MyClass\MyClass.cs:line 207

The program uses a DLL, which I have placed in a "\lib\" folder that I made in the root directory of the project; this is the ICSharpCode.SharpZipLib taht is being referred to.

Upvotes: 0

Views: 2409

Answers (2)

Rohit
Rohit

Reputation: 10246

Your code failed to find the refrence ICSharpCode.SharpZipLib.For this you can ,

  1. Go to your Console project and set the Copy Local property of your refrence to True
  2. Copy the refrence and your exe to your new project folder .Net application will automatically locate it

This should get your work done

Upvotes: 0

Gerrie Schenck
Gerrie Schenck

Reputation: 22368

You will need to copy that reference along with the .exe, simply placing it in the same directory, .net will find it for you when executing the program.

You can also make sure the referenced DLL is copied to the output directory (where the .exe is placed) by setting Copy Local to true in the properties window of the reference.

Upvotes: 3

Related Questions