How do I able to reference third party libraries in my custom module

Topics: Core, Customizing Orchard, General
Mar 6, 2015 at 8:06 AM
The thing is I've never succesfully added any third party dll files in my own module. Strange things keep happening while I do that. Especially when Web.config file need to be modified to add custom configurations required for that library.

What I did is create a new folder in my module called "libs", then copy the third party libraries dll files in that folder and reference it. Add modification required by the library in my module/web.config file or Orchard.Web/web.config file. Neither of these works.

Also, what if the library is come from Nuget ? Nuget packages are put in a packages folder by default, but not in my module's scope. Do I need to manually copy it from "packages" to "libs" in my module?
Developer
Mar 6, 2015 at 8:18 AM
What do you mean when you say "it doesn't work"? What strange things are you seeing?
It should just work, same for Nuget packages.
Mar 6, 2015 at 8:54 AM
sfmskywalker wrote:
What do you mean when you say "it doesn't work"? What strange things are you seeing?
It should just work, same for Nuget packages.
what I mean by "it doesn't work" is when I reference a dll file for my module, that module would simply be ignored by Orchard (as if it is disabled). All my controller actions returns 404 and goes to orchard NotFound page.

When I remove all references to thirparty libraries, all things back to normal.
Developer
Mar 6, 2015 at 8:59 AM
OK. Anything in the log file?
Mar 6, 2015 at 9:00 AM
My bad. It's probably the dll file's fault. I changed another package and that works.

But still I'm wondering if I install a package for my module by Nuget. Should I manually copy the dll from packages folder to my own module folder?

Some packages like ImageResizr would require web.config modification. Do I have to modify that under Orchard.Web project ?
Developer
Mar 6, 2015 at 10:03 AM
Cool.

You don't have to manually copy the dll from the packages folder over to your own module just as long as you ship the entire Orchard application including the nuget packages. If you're planning on sharing your module on the other hand, then yes, you'll need to copy over the dll's and reference them instead.

If you're using packages like ImageResizer then you'll indeed need to modify the root web.config. I think that's what we did for the Orchard.MediaProcessing module, but you'd have to check.