I did something similar; however, my cs file was already compiled into a dll. I then created an exe that would take command line arguments, the args were the name of the dll to load and, the method to execute, and the parameters it expected. All of this was done using Refelection. I didnt do it for start up scripts or anything I did it as an integration suite with third party vendors who needed their data in a format that was different from mine. Once I had the Integration Bus written(exe) whenever the bossman came in and asked if we could send over data to someone else using package X it was only a matter of making X.dll and setting it up to be loaded by the Integration Bus in cron (or a job in sql server, or...) with its respective arguments.


mono IntegrationBus.exe -t dlls/X.dll -m SomeClass -props startDate='10/01/2005',endDate='10/31/2005',propertyID=10 -meth SomeMethod

Reflection is cool.

Regards,
Shawn Vose

ted leslie wrote:
I too find it appealling to use C# in place of perl, etc.
I am not sure what your asking can happen with the mono distro.
you could however, if you don't want to just have
my_script.cs
my_script.exe
as a "pair" and use the exe to execute your script, that goes without saying.

i guess you could make a shell script that woud say

monoscript my_script.cs <arg1> <arg2>

that would compile it to a temporary file /tmp/csexe_<uniqueid>.exe (in tmp?)
and run the exe with the args essentially giving you what you want
and removing the tmp exe when done ?

no different then

perl my_script.pl <arg1> <arg2>

just that "monoscript" is this shell beast you write, which would be a few lines.

except you would have to know how to "make" your exe based on whats in the *.cs file
and not what would be in a Makefile, for its libraries ?

i would personally love to see more movement in this area .. i.e. mono/C# as a linux/unix
scripting language!
maybe in the end it just needs to be formalized by someone at mono?


-tl


On Thu, 10 Nov 2005 19:02:49 -0500
Abe Gillespie <[EMAIL PROTECTED]> wrote:

  
Hey all,

I was wondering if there's any easy way to run C# scripts in Mono. 
I'm fairly new to Linux (just at about a year) and I'd like to avoid
learning yet another language (Perl, sh, etc.).  Has anyone written a
.Net program that takes a file as input and runs that code?  Perhaps
Mono can do this natively?  How cool would it be to have startup
scripts written in C#?!

Thanks for the help as always.
-Abe
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

    
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


  

_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to