Search code examples
c#visual-studio-2015version-controldotnetzip

Add a .dll source to use classes


Im coding in c#. already written a portable console application that needs a dll to work with and it works perfect without any error.

I want to get rid of carrying that dll everywhere and copy its source or some of its classes. Im already using NetShrink software for making my exe and dll a package but its a kind of trick and not a original way.

MyQuestion: Is there any original way in visual studio or any plugins to bring a dll source into another project ? i heard from an old programmer that there is a built-in tool that bring whole .dll source to project.

What i tried: except Netshrink i tried assembly-explorer in Resharper plugin and get output as .sln project from .dll but thing get hard with this.

the dll is Ionic.Zip.dll in DotNetZip used for compressing files.


Solution

  • Actually there is no way around it. You have several options to deal with your portable project.

    1. Add the library project to your solution and reference it.
    2. Add the library (.dll) to your solution and reference it.
    3. Add the library (.dll) to your solution and Load it from Resources
    4. Merge the (.dll) to your .exe with 3rd party tools (e.g., NetShrink)
    5. Upload your library (.dll) to a NuGet Server and just install it (You could setup your own NuGet Server or use the Microsoft one)

    I personally use approach number 3. Copy the .dll to my solution somewhere, reference it, load it on demand and do not copy it to the output folder. If possible, stick to approach number 5. since its the most convenient one.