I have a TopShelf-based service and I'm trying to tell it where to get config information when I run it from the command prompt. The idea is that I can have Visual Studio specify a config file when it debugs the app, but when it runs as a deployed service, it should just use a default configuration strategy that's baked in.
I'm trying to pass a command-line argument to my TopShelf executable like so:
MyTopShelfService.exe --config C:\somepath\config.json
But I'm getting errors like this:
2012-10-19 18:00:28,302 Main ERROR Topshelf.HostFactory The service terminated abnormally
Topshelf.HostConfigurationException: The service was not properly configured:
[Failure] Command Line An unknown command-line option was found: SWITCH: config (True)
[Failure] Command Line An unknown command-line option was found: ARGUMENT: C:\somepath\config.json
I had a peek at the code and it looks like it's just treating this as an UnknownOption.
Is there a way to pass in command-line args that TopShelf should ignore, but that should flow through to my code? I'm thinking maybe something like the way Java apps pass in properties with -D or something?