Running c# dll's from command line

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

Is it possible to call c# dll's from the command line?

I am used to the Java world where classes are packaged in jar files
which can either be accessed from an application or run directly with
java.exe if there are one or more classes with main methods in them. So
i guess i am asking for an equivalent to java.exe in C#. Is there some
prebuilt app in the .NET environment that looks for a Main method in a
certain class in a dll that I can use to execute it?

I know the easiest way to get around this would be to just create a
console app that invokes the dll, but I need to know if it is possible
to run the dll directly from command line.
 
Hello!
Is there some
prebuilt app in the .NET environment that looks for a Main method in a
certain class in a dll that I can use to execute it?

As far as I'm aware, there isn't such an utility available in the .NET SDK.
This means you would need to write one yourself.

If you use Reflection, you can write yourself a generic "starter"
application for example for testing purposes.

Hope this helps.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
(e-mail address removed)
http://www.saunalahti.fi/janij/
 
What do you want to call from a DLL? A static method?

In my case it is not a static method but i guess if I could call a
static method i could get hold of an instance as well with a
getInstance() or createInstance() method. Do you know how to call
static methods?
 
Hi,


Al said:
In my case it is not a static method but i guess if I could call a
static method i could get hold of an instance as well with a
getInstance() or createInstance() method. Do you know how to call
static methods?

yes, of course! One library I build (http://www.ajaxpro.info) is doing this.
Do you need any arguments?

Regards,
Michael
 
Back
Top