Implementing a module

32 views
Skip to first unread message

Paul Bowman

unread,
Apr 10, 2015, 9:18:39 AM4/10/15
to scri...@googlegroups.com
Hi,

Can anybody help me?

I am trying the example module here: https://github.com/scriptcs/scriptcs/wiki/Modules

When I run scriptcs I see the message: DEBUG: Found assembly in bin folder: ScriptCsModule.dll. But I dont see the message I output to the console when the module is initialised.

The code I have written looks like:

    [Module("work", Autoload = true, Extensions = "csx")]
    public class WorkModule : IModule
    {
        public void Initialize(IModuleConfiguration config)
        {
            Console.WriteLine("Hello, world");
            config.LineProcessor<LineProcessor>();
        }
    }

    public class LineProcessor : ILineProcessor
    {

        public bool ProcessLine(IFileParser parser, FileParserContext context, string line, bool isBeforeCode)
        {
            Console.WriteLine(line);
            return false;
        }
    }

and the command line is scriptcs start.csx -modules work -loglevel debug

Thanks.


Filip W

unread,
Apr 10, 2015, 9:21:07 AM4/10/15
to Paul Bowman, scri...@googlegroups.com
modules are not discovered from the bin folder anymore, you need to either install it globally as nuget package or dump the dll in the root folder of scriptcs (same folder where all scriptcs dlls are located)

Paul Bowman

unread,
Apr 10, 2015, 9:48:44 AM4/10/15
to scri...@googlegroups.com, paul.bow...@gmail.com
Hi Filip,

I tried to put it into the same folder where chocolately installed ScriptCs - it didnt work

Then I put it in appdata/scriptcs/scriptcs_bin it loaded the assembly but doesn't appear to have called Initialize.

When I put it back in a scriptcs_bin folder in the same folder as the script again I got: DEBUG: Resolving from: ScriptCsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null to: ScriptCsModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

but it didnt seem to load an call Initialize.

Filip W

unread,
Apr 10, 2015, 9:56:49 AM4/10/15
to Paul Bowman, scri...@googlegroups.com
can you share this code somewhere? i can have a look

Paul Bowman

unread,
Apr 10, 2015, 10:12:34 AM4/10/15
to scri...@googlegroups.com, paul.bow...@gmail.com
I Can do but it will take a while...

The code is exactly the same as the example given on the web page I mentioned.

Paul

Paul Bowman

unread,
Apr 10, 2015, 11:45:25 AM4/10/15
to scri...@googlegroups.com, paul.bow...@gmail.com

Filip W

unread,
Apr 10, 2015, 4:39:17 PM4/10/15
to Paul Bowman, scri...@googlegroups.com
unfortunately it says it's a 404

Paul Bowman

unread,
Apr 12, 2015, 1:35:54 PM4/12/15
to scri...@googlegroups.com
hi sorry i'll sort it out soon.

Glenn Block

unread,
Apr 12, 2015, 1:47:50 PM4/12/15
to Paul Bowman, scri...@googlegroups.com
If you need help, let me know. I wrote the module system.

Paul Bowman

unread,
Apr 13, 2015, 8:24:51 AM4/13/15
to scri...@googlegroups.com

If I put the dll in the appdata/local/scriptcs/scriptcs_bin/ it loads correctly.

But not if the scriptcs_bin folder is in the same folder as the script.

On Friday, 10 April 2015 14:18:39 UTC+1, Paul Bowman wrote:
Reply all
Reply to author
Forward
0 new messages