This would be useful to me as well for the media framework modules we're working on. I also saw another discussion on this topic.
I'm not sure why that SecurityException is happening but I'm wondering do you have any Web.config in your subdirectory under ~/Modules/?
However we probably need to look at all this a different way. Couple of factors to consider;
1. Since you need to modify the root Web.config to hook in your IExtensionFolders, this can't be easily distributed in a modular fashion (we don't want end users having to manually make changes in Web.config to support it)
2. Clearly an extension can't itself tell Orchard additional places to look for extensions. This would be some kind of paradox since the extension first has to be discovered before it can tell the system anything at all!
What I would propose is you look at making changes in Orchard.Core.Environment itself allowing support of "Suite" folders containing grouped modules in this fashion.
Perhaps such folders would contain a Suite.txt manifest similar to the Module.txt manifest; the suite manifest could contain additional details regarding the overall function of the suite, and its origin.
I'm pretty hopeful the dev team would appreciate the usefulness of such changes and (post-MIX of course) might well want to bring this functionality into the core framework if you're successful.
There are however some key implementation details you need to consider;
- I note in ExtensionLoaderCoordinator, path monitoring is set up as follows:
// Monitor add/remove of any module/theme
I'm not sure if this monitors all subdirectories and files or just the top-level module folders.
- There are important factors to think about regarding Module Gallery download and updates. This could likely require some changes to gallery feeds themselves. But it would be a nice feature to be able to download and update a complete suite of packages all
Obviously this has suddenly become quite a thorny issue to solve :)
In the mean time I can suggest a couple of fairly simple things that I'm currently doing to work around this issue;
1. Using NTFS soft links / directory junctions so you can work on your projects within a single source repository whilst exposing them correctly under the Modules folder of your Orchard enlistment. If you're not sure how to do this I can post a writeup and/or
sample .cmd script, it was very easy once I'd worked it out and after nearly trashing a hard drive in the process :) ... No, really it's very safe, honestly ;)
2. Orchard 1.1 has a new feature called Recipes which allows you to batch download/install/enable any number of modules at once. So this gets around most user issues of having to install many different components, they can just download the Recipe (or perhaps
several versions of the Recipe offering them a choice of typical installations) then run a command from the web interface or command line to do everything in one go. Hopefully this story will be made easier in the future (I'm hoping for something along the
lines of Recipe execution directly from the Gallery).