Mods Directory Enumeration

Oct 15, 2008 at 10:06 PM
Hi All,

I've been working on an app for a while now, all without issue ... I've just switched to Release mode from Debug and I'm seeing an unhandled exception informing me that the DirectoryModuleEnumerator was unable to find my Mods directory!

The code I'm using is:

        protected override IModuleEnumerator GetModuleEnumerator()
        {
            return new DirectoryLookupModuleEnumerator("Mods");
        }

Why would this work fine in Debug and fall over in Release?

Cheers,
Oct 16, 2008 at 2:59 PM

Hi

 

Did you change your module assemblies' Output Path or set up a Post-Build event to automatically copy the assemblies to your Mods folder after each build? The Directory Lookup Module Enumerator assumes that your module assemblies are stored in a folder named Mods under the folder where the your application executable is located.

 

If what you want is to change the Output Path of your modules, perform the following steps:

1.       Right-click in the module’s project and then click Properties.

2.       In the Build tab, go to the Configuration combo box and select All Configurations.

3.       Go to the Output path text box and insert the relative path to your Mods folder.

 

If you prefer to use a Post-Build event perform the following steps:

1.       Right-click in the module’s project and then click Properties.

2.       In the Build Events tab, go to the Post-build event command line text box and insert your command there. You can use a command similar to the following, which is similar to the one used in the Directory Lookup Modularity QuickStart.

xcopy "$(TargetDir)*.*" "$(SolutionDir)YourApplication\bin\$(ConfigurationName)\Mods\" /Y

 

For more information related to the Directory Lookup Module Enumerator check the following articles:

·         Using the Directory Lookup Module Enumerator

·         Dynamic Modularity QuickStarts

 

Please let me know if this helps.

 

Mariano Converti

http://blogs.southworks.net/mconverti
Oct 16, 2008 at 6:50 PM
Hi Mariano,

I had in fact already setup a post-build event to comp together the app in a specific location, I had also setup the options to execute these external .exe's when i start the app from within VS.  I think the problem is that I'm using VS C# Express and it doesn't support this in Release mode, Debugging this 'external' .exe is fine however.

C# Express is a really great IDE considering its free but they have chopped some curious things out at the same time.