 So you've got your default templates, but there's also custom templates that so many people within the.NET community have created that you can take advantage of. So if you want to learn how, find out on this episode of Visual Studio Toolbox. Hey everyone, welcome to Visual Studio Toolbox. I'm your host Leslie Richardson, and I'm joined once again by senior PM, Saiya Tashimi. Welcome. Hello. How's it going? Thank you for having me back. Yeah, likewise. So once again, we're going to be talking about project templates and specifically how to take advantage of the project templates that the.NET community creates. So can you tell us more about that? Yeah, that's right. So some functionality that we have built into.NET new and also now Visual Studio and Visual Studio for Mac is being able to install custom templates that have been created by third parties. So templates that have been created by the community, some of them might be open source templates, others might be created by companies like Amazon or various different companies there. So yeah, it's all about how to find templates, how to install them and also how to use them from.NET new and Visual Studio. That's really cool. So yeah, I'm sure there's tons of different reasons why you'd want to take advantage of the different templates that companies and just random people create. So I'd love to see more. Yeah, that's right. Great. Okay, cool. Yeah. So when we're working with community templates or custom templates here, the first hurdle is how do you discover these templates? So let me go into my browser here, and then I'll show you a few different options for how you can discover templates. So your first option is really newget.org. So here's where I can search for templates. Let me show you how to do that. There's a popular template that's called.NET boxed. So I can do a search on newget.org, and then in the filter here, I can expand the filter and then select template. Now, this will only show me.NET new templates. So if I was to drill into this box.templates, here instead of the command to add a package to a project, we can see that you get the.NET new install command here. So I can just go ahead and copy this command, and then drop into a terminal, and then just paste that, and then this will install that template, and then we can use this from the command line, as well as in Visual Studio and Visual Studio for Mac. So let's go to, so I just installed that one. Let me see where it's here. Here's the box templates here. So we got the Acepin and Core API boxed, and the graph one is from there, the Orleans one and the newget package. All right. So that's one option for how to discover community templates. Another option is in my spare time, I've developed this website.NET new.AzureWebSites.NET. So you can go here to also find a community template. So on newget.org, it's just searching through the metadata for the package itself, but on this website, it will actually look for the, it will do searches for the individual templates as well. So let's say if I wanted to find templates that were created by Mads Christensen, I can do a search for Mads. We'll see, there's several different kind of templates here that Mads Christensen has created here. We can see I've got this mini-blog template, so I can go ahead and drill into that as well. Here you can see we get that same exact command for how to install the template, and then in addition, there's also command for how to actually execute this particular template here. So that's another option for how to find templates. They will be adding functionality into.NET new to search and find templates as well, but that experience is going to be changing. So I'm not going to go through what we have today because it's going to be significantly different. All right. Now let me go back to newget.org. If I was to search for Syed, I've got a template here that I've already created, and this template is available on GitHub as well. Let me go ahead and copy the command to get that one installed. So this template is available on GitHub, and you can get to it through this aka link, so aka.ms-netcore-templates that will bring you to this GitHub repository. Let me go ahead and install this template because this is the one that we're going to be working through throughout this set of videos here. So let me get this one installed here. All right. So now that I've installed that, we can see I've got some additional templates. I got SyedTool, SyedWeb, and SyedWebAuth. All right. So now what I need to do is, let me go into Visual Studio and I will show you what needs to be done in order to get these templates to show up. The first thing that you'll need to do is to go in and turn on this preview feature to show these templates. So I went to Tools, Options, then I'm going to go down to Preview Features, and then we'll scroll until we get to showall.netcore-templates. So you check that checkbox and then you'll have to restart your Visual Studio to get that option to appear. I'm going to go ahead and restart Visual Studio here as well since I installed that additional template. All right. So now all I did was I ran the .netnew install command a couple of times to get these templates installed with .netnew. Then after I checked that checkbox, now we should see those same exact templates starting to appear in Visual Studio itself. So for example, if I was to search for box, I should see the ace pinnet box templates. I have another community template pack installed. It's a template for making bots essentially so that we could use those as well. But let's go back to the one that I've created here. So we can see now I've got those three templates that were installed on the command line. I've got my Sayit tool, which is a console application. Then I've got two different flavors of the web app here. Let me go into just the regular vanilla web app here and let's take a look at the experience. But let's also do note that we do have the same exact experience in Visual Studio for this custom template as what we have for the templates that are built-in. So I can customize the icon, I can customize the name and description as well as these tags, and if I was to search on these tags, the search results would include these custom templates as well. So for all intents purposes, it looks like this is a built-in template. You can't tell the difference between it. That is really cool. Yes. Let's go to next year and we can see, I get the same exact experience as I would for a built-in template here and I've got this customized name as well. So we'll say, my new web. So next, then we can see, we also have some custom parameters here. So I've got the target framework, like what I would expect, but I also have parameters here that are specific to this exact template. So we can say Sayit i Hashimi for title, we'll say demo. I feel like that has to be the author name. Then create that one. Then I'll show you some of the things that have happened here after we created this project. So we created the project. Let me go and take a look at the program.cs. So we can see when I created this project, I gave it a name of my new web. As expected, the namespace is set to my new web and that's just how the other templates behave. Let me go into the index.cshtml. I can see that my author name has been placed here. Then the site title is in the shared, it's in the layout here somewhere, demo. Yeah, there it is, demo. Yeah. So yes, and then I can build, let me just do a control shift B to go ahead and build this guy. So we can see here that the project was built successfully. I can obviously run this with control F5 or F5 and I think the point that I want to really stress here is you create a template one time, you install it and the users will get the same exact experience for the built-in templates, as well as these third-party templates. What I've shown here is inside Visual Studio, but we also have the similar support in Visual Studio from Act. So they also have a preview flag that you need to go and enable and there's details here at that AKA link that I showed earlier. It was aka.ms.netcore templates. So if you were to scroll down here, you see how do I enable it in Visual Studio, and then how do I enable it in Visual Studio for Mac. So that's the options there and that's really about it for this video here. It's really just we covered how to install a template, we covered how to use that template from the.NET new console. I'm not sure if I actually exercise that here, but it's the exact same way that you do it with the built-in template, and we covered that in the previous video, and then we also showed how to use it in Visual Studio 2019. That is awesome. I just love how those custom templates are made to feel not inferior to the built-in ones, because for many people, I'm sure those custom templates are essential for their development. So, yes, absolutely for sure. Yeah. So as we mentioned before, this is part of a larger series on.NET templates. So what are we going to be talking about next time? I think next time we're going to be getting into how to actually create your own template. I think we'll be focused on creating a template and then using that with.NET new, and then after that, we'll get into how do we use that with, how do we find TUNET for Visual Studio? Yeah. Good stuff. So TUNET next time, and until then, happy coding. Thank you for watching and I'll see you in the next video.