One of the values of using tools for development is the productivity they provide in helping start projects, bootstrapping dependencies, etc. One way that we’ve seen developers and companies deliver these bootstrapping efforts is via templates. Templates serve as a useful tool to start projects and add items to existing projects for .NET developers.

Visual Studio has had templates for a long time and .NET Core’s command-line interface (CLI) has also had the ability to install templates and use them via dotnet new commands. However, if you were an author of a template and wanted to have it available in the CLI as well as Visual Studio you had to do extra work to enable the set of manifest files and installers to make them visible in both places. We’ve seen template authors navigate to ensuring one works better and that sometimes leaves the other without visibility. We wanted to change that.

Starting in Visual Studio 16.8 Preview 2 we’ve enabled a preview feature that you can turn on that enables all templates that are installed via CLI to now show as options in Visual Studio as well. To enable this option visit the Preview Features options in the Tools…Options menu and look for the “Show all .NET Core templates in the New Project dialog” (we’re awesome at naming) checkbox and check it:

Image of Preview Features dialog

After enabling you need to restart the Visual Studio instance to get this capability. After restarting and choosing to create a new project you’ll see some slight differences in the experience. The full list of templates is shown and the names are now being driven from the manifest data in the template’s template.json file.

Image of New Project Dialog with templates listed

Previously as an example we had a special dialog for ASP.NET projects. When the new experience is enabled, this no longer exists, and all project templates use the same infrastructure. This new model reads the options to be exposed to the dialog and renders the UI to enable the selection. Here is the example of an ASP.NET Core web application:

#.net #.net core #asp.net #visual studio #cli #visual studio

.NET CLI Templates in Visual Studio
1.90 GEEK