public static void Command(CommandLineApplication command) { var clientPage = command.Option("--html-page", "Path to the HTML Page containing the Blazor bootstrap script tag.", CommandOptionType.SingleValue); var references = command.Option("--reference", "The path from the _bin folder to a given referenced dll file (Typically just the dll name)", CommandOptionType.MultipleValue); var jsReferences = command.Option("--js", "Adds a <script> tag with the specified 'src' value", CommandOptionType.MultipleValue); var cssReferences = command.Option("--css", "Adds a <link rel=stylesheet> tag with the specified 'href' value", CommandOptionType.MultipleValue); var outputPath = command.Option("--output", "Path to the output file", CommandOptionType.SingleValue); var mainAssemblyPath = command.Argument("assembly", "Path to the assembly containing the entry point of the application."); var linkerEnabledFlag = command.Option("--linker-enabled", "If set, specifies that the application is being built with linking enabled.", CommandOptionType.NoValue); command.OnExecute(() => { if (string.IsNullOrEmpty(mainAssemblyPath.Value) || !clientPage.HasValue() || !references.HasValue() || !outputPath.HasValue()) { command.ShowHelp(command.Name); return(1); } try { IndexHtmlWriter.UpdateIndex( clientPage.Value(), mainAssemblyPath.Value, references.Values.ToArray(), jsReferences.Values.ToArray(), cssReferences.Values.ToArray(), linkerEnabledFlag.HasValue(), outputPath.Value()); return(0); } catch (Exception ex) { Console.WriteLine($"ERROR: {ex.Message}"); Console.WriteLine(ex.StackTrace); return(1); } }); }
public static void Command(CommandLineApplication command) { var clientPage = command.Option("--html-page", "Path to the HTML Page containing the Blazor bootstrap script tag.", CommandOptionType.SingleValue); var references = command.Option("--reference", "The path from the _bin folder to a given referenced dll file (typically just the dll name)", CommandOptionType.MultipleValue); var embeddedResourcesFile = command.Option("--embedded-resources", "The path to a file that lists the paths of .NET assemblies that may contain embedded resources (typically, referenced assemblies in their pre-linked states)", CommandOptionType.SingleValue); var outputPath = command.Option("--output", "Path to the output file", CommandOptionType.SingleValue); var mainAssemblyPath = command.Argument("assembly", "Path to the assembly containing the entry point of the application."); var linkerEnabledFlag = command.Option("--linker-enabled", "If set, specifies that the application is being built with linking enabled.", CommandOptionType.NoValue); command.OnExecute(() => { if (string.IsNullOrEmpty(mainAssemblyPath.Value) || !clientPage.HasValue() || !references.HasValue() || !outputPath.HasValue()) { command.ShowHelp(command.Name); return(1); } try { var embeddedResourcesSources = embeddedResourcesFile.HasValue() ? File.ReadAllLines(embeddedResourcesFile.Value()) : Array.Empty <string>(); IndexHtmlWriter.UpdateIndex( clientPage.Value(), mainAssemblyPath.Value, references.Values.ToArray(), embeddedResourcesSources, linkerEnabledFlag.HasValue(), outputPath.Value()); return(0); } catch (Exception ex) { Console.WriteLine($"ERROR: {ex.Message}"); Console.WriteLine(ex.StackTrace); return(1); } }); }
public static void Command(CommandLineApplication command) { var clientPage = command.Option("-hp|--html-page", "Path to the HTML Page containing the Blazor bootstrap script tag.", CommandOptionType.SingleValue); var references = command.Option("-r|--reference", "The path from the _bin folder to a given referenced dll file (Typically just the dll name)", CommandOptionType.MultipleValue); var outputPath = command.Option("-o|--output", "Path to the output file", CommandOptionType.SingleValue); var mainAssemblyPath = command.Argument("assembly", "Path to the assembly containing the entry point of the application."); command.OnExecute(() => { if (string.IsNullOrEmpty(mainAssemblyPath.Value) || !clientPage.HasValue() || !references.HasValue() || !outputPath.HasValue()) { command.ShowHelp(command.Name); return(1); } try { IndexHtmlWriter.UpdateIndex(clientPage.Value(), mainAssemblyPath.Value, references.Values.ToArray(), outputPath.Value()); return(0); } catch (Exception ex) { Console.WriteLine($"ERROR: {ex.Message}"); Console.WriteLine(ex.StackTrace); return(1); } }); }