I have a tool written in C# that used to work (I didn't write it). What it does is basically run C# scripts using CS-Script. This scripts can use references to DLLs and EXEs (I think) by using the directive:
//css_reference library.dll;
My application, let's call it MyApp, is compiled into an EXE file. It also declares a few types that are meant to assist the scripts in doing things. As I understand from one of the example scripts I have, that used to work, this is achieved by adding a reference in the beginning of the script like this:
//css_reference MyApp.dll;
Note that my application is not a DLL so the file MyApp.dll doesn't exist. I do have a MyApp.exe though.
I was thinking maybe there's some mechanism used by CS-Script that treats my EXE as a DLL and that's why it worked before (I wasn't working on this tool then) but when calling CSScript.Load
I get the error:
Compiler Error CS0006: Metadata file 'MyApp.dll' could not be found
I understand the file doesn't exist and this shouldn't be surprising but I know for sure that this used to work so I was thinking maybe something's wrong with my Visual Studio project settings. I tried creating such a DLL but then it clashes with the running EXE because of similar namespaces. I also tried to change the directive to //css_reference MyApp.exe;
but that also didn't work.
My question is, how can I refer classes and methods contained in the running application (MyApp.exe), using CS-Script, from within the script?