The documentation (here and here) is notably lacking information on how references in modules are resolved:
References Resolution
(TODO: Explain how Orchard figures out references by looking at the "References" section of the csproj file as well as looking at additional assembly binaries dropped in each module "bin" directory)
Unfortunately, this is exactly the information that I need. I have created a custom module that has a reference to a custom-built, in-house DLL. When I try to use a class from this DLL, I get the following Exception:
Could not load type 'Custom.MyClass' from assembly 'Custom, Version=[version], Culture=[culture], PublicKeyToken=[token]'.
So, my question is thus: What does Orchard do with module references, and is there anything special I need to do to have Orchard pick up my module's references?
EDIT: Looks like some better information can be found in this blog post and its comments. However, my custom assembly already exists in src\Orchard.Web\App_Data\Dependencies
, and I'm still getting the error.
EDIT2: We have a copy of the custom DLL in the lib
folder, so I tried referencing that one instead (as we have another module that does so successfully), but still no change.
EDIT3:: In reference to the previous two edits, it's not copying from the lib
folder to the App_Data\Dependencies
folder. I just added a new DLL to the lib
folder and referenced it, and it didn't appear in the Dependencies
folder. I think the current Custom.dll
isn't replacing the one that's there, which is why I'm getting the error I am. But why isn't Orchard copying into the Dependencies
folder?
In order to have Orchard to use your custom module you need to have it on path: your_web_application_path/Modules/your_custom_module, we are using sym links to achieve that.
Then your main module (web application) should see your custom module. If you are adding new module to existing orchard app, you probably need to enable it by hand from admin panel/modules menu. For new installations you could add feature enable directive to your recipe and add dependency to main module.txt file (assuming you want your module always on).
Another trouble shooting tips:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With