Loading a script from a cs file and accessing host methods, properties etc?
问题 I'm just having a play with Roslyn but unsure on how to do the following. To keep this simple, lets say I have a host program which has a method like so public void DisplayMessage(string message) { MessageBox.Show(message); } Can I then have a script file called MyScript.csx and then somewhere in the script have something like void Main() { Host.DisplayMessage("I am a script"); } Then I have the host load the file and execute it. If this sort of thing can't be done, is there a scripting