I'd like to be able to run a specific function in my DLL from the command line without changing my Main function.
e.g.
If I had the code:
namespace MyApp;
static class Program
{
public static void Main(string[] args)
{
ConsoleWrite("Starting program v" + Version());
// program logic
}
static void PrintVersion() =>
Console.WriteLine(Version());
public static int Version() => 2;
}
Then I would run something like:
dotnet exec MyApp.dll -func PrintVersion
Output:
2
Is this possible?
I've looked at the MS docs for the dotnet command and nothing like this appears to be there. But I may be missing something, or there may be another command that I can use.