-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build a UI in Visual Studio for Dotnet New Templates #481
Comments
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 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:
This WPF dialog would also handle prompting for the parameters that the template makes available. With this model when you ship your template for 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. |
That sounds great. It would be great if the installed templates showed up as items in the VS New Project dialogue instead of having to click through to a separate templates screen. To do that, I suppose, you would need to add some kind of category property to template.json. Regarding cross-platform, agreed it might look strange but I think VS Code should also have a UI that makes sense for creating projects. |
This would require changes to the core New Project Dialog in Visual Studio. I'm going to have some discussions with that team soon, but that's not something that's likely to happen any time soon. It is one of my long term goals though.
No disagreement. On the VS Code side I think it would be quicker if we (the community) create an extension. |
I'd like to help with that. |
I'm also interested in this feature. What is the status for this? VS 15.3 is released on August 14 and there is no mention of this feature (neither in the following four patches) |
I posted an announcement a few weeks back, see #1209. |
@sayedihashimi Isn't it possible that VS makes this UI himself? I mean they have the metadata for the parameters and knows what templates are installed. Rider goes a similar way. That other way seems way too complicated and time expensive. |
@maracuja-juice I've moved to a different team, so I can't really speak to this any longer. Hopefully someone else here can. |
Any update with adding a dotnet new template UI option in Visual Studio 2019? While Visual Studio 2019 preview 1 demos the updated startup and template creation process, it does not seem to offer anything in the way of additional dotnet new template support yet. |
We are really missing some guidance on how to create, install and use templates that work both in Visual Studio as well with the new dotnet cli or if that is not possible how to port one to the other. What is the current state of the consolidation or interoperability of the two templating systems? |
I considered working on a solution to this myself at one point but ultimately decided against it since the readme would suggest this will be officially supported at some point in the future. With some guidance I'd be willing to commit some time to assist with the official development of this feature. |
@seancpeters is there an update on this issue? This is something I'm also very interested in. It would make documenting .NET Core with Visual Studio and the CLI so much easier. But I really think you guys should sync with the Visual Studio team and get this built into Visual Studio directly. It should just consume .NET Core templates directly without any other special dialog steps. |
@Thraka - We've been discussing some plans to make the use of templates more uniform between VS & the Cli, but nothing definite at this point. |
@seancpeters This issue has been going for a couple years now, and .NET Core 3.0 is shipping in a months time, and I can imagine with WPF and WinForms coming in, this really starts to be needed, as VS would be the main way to build those projects, rather than the CLI. I'm trying to figure out how to ship my .NET Core WPF templates in a VSIX so they both work in VS and .NET Core CLI, but lack guidance on this. |
The VS tooling team just finished a redesign of the new project dialogue, lets hope they can now work on a UI for I've started to think that it would be great to make a |
@DamianEdwards talks a little about their plans with templating on this ASP.NET Core community standup (somewhere around minute 50). The bad news is that it will probably still take quite a long time (far beyond .NET Core 3.1 timeframe would be my guess). The good news is that they are going for a solution that works across VS, VSMac and the CLI. I heard him say the word DSL. |
There is currently no mechanism for discovering the templates from feeds automatically. What is supported today is the display and creation of a template installed via dotnet new --install from the command line to the CLI hive. The Visual Studio host will sync any templates found in this hive for use in Visual Studio. This assumes the template is compliant with guidance as described. The advantage of this feature is that templates can now be used within Visual Studio without the need for a stub vstemplate file. |
Hi @phenning, I don't think the template needs to be discovered from the feed, If I run |
@DavidJFowler: When you run |
This is the most likely cause, assuming that the preview feature is enabled and the template is accessible via dotnet new. If this still doesn’t work for you, let me know which template you are trying to use and I’ll install it locally and debug. |
My templates are solution templates, rather than project templates. Could that be the reason? |
That would be the cause then. The type does needs to be "project" for use in the new project dialog. For multi-project templates, for example the Blazor template, if you don't specify any of the project files as primary outputs, Visual Studio will add all the discovered project files to the loaded solution. You can also specify the primary outputs explictly. The Blazor template uses the explicit method. |
@davidfowl We are planning to look at what if any differing behavior we need to have to support type: "solution". See sayedihashimi/template-sample#7 |
@davidfowl try out my template analyzer, more info at https://twitter.com/sayedihashimi/status/1326622265144905731?s=20 |
Template team, I removed the "triaged" tag so that in the next session, this issue is assigned to Phil's team. |
I think we can close out this ticket, we've already implemented the support in the previews of Visual Studio. |
@sayedihashimi: It's better than that - it's in the released (GA) version of Visual Studio - still behind a "preview features" flag, but you don't need a preview version of VS itself. |
@sayedihashimi Any ideas when the 'solution' template type will get released? Also interested in the timeline for the other issues raised in https://github.com/sayedihashimi/template-sample/issues. |
@jskeet yes, that is more accurate than what I posted. @RehanSaeed we are hoping to get solution support into 16.9, but there is a chance it can slip to 16.10. |
When is it expected to not be behind the "preview features" flag? Is it expected to become non-preview for 16.9? Or sometime after that? If so, is 16.9 still planned for release in December? I'm trying to get a feel for when this will be available out of the box without messing with settings. |
@rbwhitaker: I have no idea about any of those things, I'm afraid. I'm just a VS consumer like others. |
Maybe I should be at-mentioning @vlada-shubina instead? Do you have any insight into the timing of the "Show all .NET Core templates in the New project dialog" feature becoming mainstream, and not behind a preview toggle? If this issue got closed, does that mean the next 16.9 preview will have it as a formal part of the program? |
@sayedihashimi do you have any insight on this? Thank you. |
@rbwhitaker in 16.9 the preview flag will default to On. If users have any issues they can turn that flag off, but we are hoping that we will run into only a few issues. Let me know if you need any more info. |
@sayedihashimi, thank you for the answer. That was what I needed to know. Do we have a rough timetable for 16.9's final release? I believe I heard December (this month). Is that still the best guess? @vlada-shubina thanks for helping get my question to the right people! (And sorry for spamming like 5 messages. My cat jumped on the keyboard and somehow got my message posted like five times within a fraction of a second before I grabbed him.) |
@rbwhitaker sorry, I am no at liberty to give any specific dates, but I do not believe that it will be released this year. I looked to see if there was any public message about the release date but I did not find any.
Haha, it's normally the dogs fault, but now it's the cats turn :) |
I swear I heard December, but the place I thought I heard it was in the .NET Conf videos, and after reviewing it, I don't see anything. It seems like I jumped to a conclusion somewhere. Thanks for helping me get straightened out! 😃 |
@rbwhitaker no problem, glad I could help. |
Any updates on this, @sayedihashimi? I've been watching the 16.9 Preview release notes carefully, and this change has yet to be called out. Is it still coming? Did it happen without being called out? Has it been delayed? I know I can go enable this feature myself, but I've got a group of new devs that I work with, and getting easy access to the new template system will make the first steps of their C# journey much easier. |
@rbwhitaker it will be on by default when 16.9 is released. |
Love the concept, but unfortunately, this preview feature doesn't work for me. With version 16.11.8, I have it enabled and have 2 templates created as NuGet packages and installed using the CLI and they appear nicely in the CLI and I can create projects using the template from the CLI but the templates do not appear in the UI New Project Dialog. I've installed/uninstalled templates, restarted Visual Studio, cleared my Visual Studio cache, rebooted machine - all numerous times and to no avail. I believe there must be something different in the template.json file that the UI needs that I'm not providing. This may not be the right audience for this but I bet there are others struggling with this and I'm not alone. Maybe there is someone that can point me in the right direction. Any input and advice is appreciated. Just for completeness here is my template.json file.
|
As far as I know, for the template to show in visual studio, it needs additional json file in some specific folder. I don't have the link handy but if I remember correctly I read it in either dev blogs or Microsoft docs site somewhere. |
@bcausey88 can you share a sample package that you are having issues with? @nvmkpk in VS2022, you no longer need to add a host file. See https://aka.ms/netcore-templates. |
@bcausey88 I took a look at the feedback ticket you submitted and asked for some additional information to help diagnose. Do you have .NET 6 installed on this machine by chance? If you are, it could be that you are installing the template into the NET 6 template hive, which would not be readable by Visual Studio 2019. You can see by looking at the output of dotnet --info and see if the first section is similar to the following. If that is the case, you can create a global.json in a folder and pin the sdk version to the version of .NET 5 which is also installed. Then, make sure you run dotnet new --install from within that folder. Visual Studio 2022 will correctly recognize templates installed into the .NET 6 template hive.
|
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:
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.
The text was updated successfully, but these errors were encountered: