public static class TemplateCatalogThe dotnet new templates, read out of this assembly.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
⚠ Here rather than in Tools/Vixen.Cli, which is where it was, and for ProjectWorkspace's reason. The editor's New Project made two directories and called it a project — so every project born in the editor had no .csproj, and Build and Run was greyed for all of them with a message naming a terminal command. An editor that cannot finish the project it just made is failing doc 20's second bar on the first screen a new user sees. The scaffold had to be reachable from both heads, and a second copy of it is the thing this type was created to prevent one level down.
There is one tree of template files and two things that instantiate it. Tools/Vixen.Templates owns the files; dotnet new reads them out of the template package, and this reads the same files out of this assembly, which is where the build embedded them. That is the whole reason this type exists: the previous arrangement held the scaffold as C# string literals beside a template pack that did not exist yet, and the moment the pack existed there would have been two copies of every file with nothing keeping them equal.
Why the files are the source and the C# is generated from them, rather than the other way round. ScaffoldRunner's remarks used to say the pack should be generated from its strings. It is the wrong direction: dotnet new consumes real files with real names and a .template.config/template.json beside them that no C# string could produce, so generating the pack means generating something no human reviews. Reading them the other way is a fifty-line reader and both sides consume exactly what ships.
What this deliberately does not implement. The template engine has conditionals, computed symbols, renames and post actions. This reads sourceName substitution and nothing else, and the templates are written to need nothing else — a second, partial implementation of a templating language is a thing that silently disagrees with the real one.
Fields and properties (2)
public const string VersionTokenThe token every template writes where a package version belongs.
public static IReadOnlyList<ProjectTemplate> AllEvery template this tool can write.
Methods (2)
public static bool TryFind(string shortName, out ProjectTemplate template)Finds a template by any of its short names, case-insensitively.
public static bool IsTextFile(ReadOnlySpan<byte> content)Whether a file is one to substitute into, or one to copy across untouched.
Used by (6)
- ProjectScaffoldVixen.Editor.Core
- ProjectScaffoldTestsVixen.Editor.Core.Tests
- ProjectTemplateVixen.Editor.Core
- ScaffoldRunnerVixen.Cli
- TemplateTestsVixen.Templates.Tests
- VixenCommandVixen.Cli