public static void Main(string[] args) { CommandLine.Parser.Default.ParseArguments <Options>(args) .WithParsed(o => { Config config = Config.Default; if (!File.Exists(o.XmlFile)) { throw new Exception( string.Format("The file could not be found: {0}", o.XmlFile)); } if (!File.Exists(o.AssemblyPath)) { throw new Exception( string.Format("The file could not be found: {0}", o.AssemblyPath)); } if (o.ConfigFile != null && !File.Exists(o.ConfigFile)) { throw new Exception( string.Format("The file could not be found: {0}", o.XmlFile)); } var assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + o.AssemblyPath; Console.WriteLine("Using assembly at path " + assemblyPath); var assembly = Assembly.LoadFile(assemblyPath); if (o.ConfigFile != null) { config = JsonConvert.DeserializeObject <Config>(o.ConfigFile); } var rootElement = XElement.Load(o.XmlFile); var types = Parser.ParseXml(rootElement, config); DocGenerator.GenerateDoc(types, assembly); }); }