question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build a UI in Visual Studio for Dotnet New Templates

See original GitHub issue

VS is where all the users are at for consuming templates. I’m having huge problems getting my current VSIX template working with VS 2017. Every VS upgrade breaks something which is hugely frustrating. I’d like to be in the template authoring business, not the VSIX authoring business.

Visual Studio Template VSIX

It would be great if there was an easier way to build a project template VSIX (or some other mechanism) around my template NuGet package with a feature selection UI built around template.json. That way template authors could easily release their templates to their biggest market. Whatever the mechanism for getting my template into VS, I’d like it to appear in the Visual Studio Gallery.

Icons, Logos & Banner Images

It would be great to include icons for the template and any symbols in the template. I propose extending the template.json file to add these. I’ve shown the values as URL’s but they could equally be file paths relative to the .template.config folder:

{
  "name": "ASP.NET Core 1.1.1 MVC 6 Boilerplate API",
  ...
  "logo": "http://example.com/logo.png",
  "banner": "http://example.com/banner.png",
  "symbols": {
    "Swagger": {
      ...
      "icon": "http://example.com/swagger/icon.png"
    },
    "PrimaryWebServer": {
      ...
      "icon": "http://example.com/primarywebserver/icon.png"
      "choices": [
        {
          "choice": "Kestrel",
          "icon": "http://example.com/primarywebserver/kestrel/icon.png"
        },
        {
          "choice": "WebListener",
          "icon": "http://example.com/primarywebserver/weblistener/icon.png"
        }
      ]
    }
  }
}

Cross Platform Feature Selection UI

Another idea is to make the feature selection UI cross-platform so a potential extension could also be created for Visual Studio Code. A simple ASP.NET Core UI could be fired up as that’s already cross platform. Once features have been selected and you hit ok, you shutdown the ASP.NET Core site and work the templating engine magic.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:17
  • Comments:70 (29 by maintainers)

github_iconTop GitHub Comments

6reactions
sayedihashimicommented, Jul 30, 2020

Hi everyone, I wanted to let you know that my team is working to automatically display templates in Visual Studio that were installed with dotnet new —install. We are still ironing out the details, but it is in progress.

5reactions
sayedihashimicommented, Mar 26, 2017

Hi @RehanSaeed thanks for the issue. This is something that we are very much interested in. We’ve already started working on it actually.

For the cli we are planning to implement --install, --uninstall, and --update for the cli in dotnet new.

For Visual Studio we are planning to create a new entry in the New Project Dialog which will launch a WPF dialog that allows you to:

  • View installed templates, and create a project from one
  • Install/Uninstall templates
  • Update templates

This WPF dialog would also handle prompting for the parameters that the template makes available.

With this model when you ship your template for dotnet new, it will be available also to Visual Studio. You wouldn’t need to worry about any Visual Studio specific work (unless you wanted to customize that experience).

If you’re specifically looking to create a new entry in the New Project Dialog, I think the best thing to do there is to create a new VSIX containing your .vstemplate which has a custom wizard to invoke the Template Engine. The code for our WPF dialog will be open source so you should be able to create such a wizard for your own specific scenarios. I can help you with this as well when the time is right.

With respect to the cross platform UI idea. I think its an interesting idea but, if we implemented that I think we will have one UI used across various different scenarios. This isn’t the desired result. In Visual Studio when creating a project I want to go through the familiar UIs that I’m used to. It would be strange for VS to launch a UI that looked different. Also the same can be said about VS4Mac and other IDEs/Editors that are integrated with the Template Engine. The specific UI/UX needs to be implemented in a first class way for that specific scenario. So having a shared UI is not that useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom templates for dotnet new - .NET CLI
You can create your own custom templates for any type of project, such as an app, service, tool, or class library. You can...
Read more >
Create a project template for dotnet new - .NET
This tutorial is part two of a series that teaches you how to create, install, and uninstall, templates for use with the dotnet...
Read more >
Create a template package for dotnet new - .NET
With .NET, you can create and deploy templates that generate projects, files, and even resources. This tutorial is part three of a series ......
Read more >
dotnet new <TEMPLATE> - .NET CLI
The dotnet new command creates new .NET projects based on the specified template.
Read more >
NET default templates for dotnet new - .NET CLI
To list the built-in templates, run the dotnet new list command: .NET CLI ... For a list of default C# versions, see Defaults....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found