سؤال

How does the execution system in Windows know to run the main method automatically? I.E If I am trying to trigger a DLL from a "class library" (preferrably) or a "console application" using Windows Scheduler, how does it know which class to invoke the main method on? (if there are multiple in the project).

Also can I use a project of type "Class library" with Scheduler?

هل كانت مفيدة؟

المحلول

No, you cannot (at least as far as I know). You can, however, create a simple command-line front-end (an exe) to your DLL and you can invoke that through the scheduler. You can pass various command-line parameters to it to control what actions to perform and how.

You simply need to create a console application project and add a reference to your DLL; you can then call public exported functions from the DLL (or you can use public managed types if it's a managed DLL).

نصائح أخرى

Agreed with xxbbcc (you beat me to the punch!). You can't execute DLLs directly.

You can execute a method on a DLL with RunDll32.exe, but they have to be written specifically to allow for this. You wouldn't be able to do this with .Net DLLs.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top