0

I'm making a console window that runs a game server and I'd like to add commands for various things. Since commands will require parameters I've decided to use the ManyConsole nuGet.

I've made an test project and have added the built .dll to my server's list of references but am having difficulty figuring out how to send input to the text project .dll.

I've never used PowerShell before to launch applications but I was able to run the ServerCommands project on it without issue, and it's got me thinking maybe I should just built the whole server to be run through PowerShell, the whole thing is static anyway.

ServerCommands.dll

    public class Program
    {
        public static int Main( string[] args )
        {
            var commands = GetCommands();

            return ConsoleCommandDispatcher.DispatchCommand( commands, args, Console.Out );
        }

        public static IEnumerable<ConsoleCommand> GetCommands()
        {
            return ConsoleCommandDispatcher.FindCommandsInSameAssemblyAs( typeof( Program ) );
        }
    }

Server

    internal class Program
    {
        private static void Main( string[] args )
        {
            string[] t = new string[1] { "test" };

            ServerCommands.Program.Main( t );
        }
    }

returns error: System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'

Tarc
  • 3,214
  • 3
  • 29
  • 41
Anthony
  • 301
  • 1
  • 2
  • 13

1 Answers1

0

I am not sure, but it sounds like there could be a mismatch in projects target framework setting'? What target framework does the console app "Server" have, and what is the target framework of ServerCommands.dll?

I am assuming the second "Server" project has an output type of console application.

Frank Schwieterman
  • 24,142
  • 15
  • 92
  • 130