How can I install/enable dotnet file templates?

Answered

I have installed a dotnet template pack for avalonia, and the project templates show up in Rider's new project dialog as expected. My problem is that there are other templates in that pack that are file templates like Window and UserControl. When I right click on my project and hover over "Add", these templates don't show up

I have initially installed the template pack in the new solution window, and they work, so that means that Rider clearly supports dotnet templates with .template.config/template.json files. Am I missing something? Do I have to enable the file templates somewhere?

3 comments
Comment actions Permalink

Hi Lazar! 

Unfortunately, it is not possible to add file templates like this in Rider at this moment. We have feature requests about this: RIDER-13364 and RIDER-24197. However, you can create templates manually in File | Settings | Editor | File Templates | Other Languages.

We also have a feature request for Avalonia support. Please, feel free to upvote them to be notified about the progress and raise their priority. 

Should you have any questions, let us know. 

 

0
Comment actions Permalink

Thank you for the quick response. I do have a question. I would like to create the templates manually, as you have said, but I am confused about how that menu works. First of all, how can I use variables in custom made templates? When I click on other factory templates, on the left menu, such as XAML (C#), it gives me the option to edit variables like HEADER, CLASS and NAMESPACE. Especially namespace would be very important since i'm working with .NET projects.

Also, I want to create multi-file templates, just like the Window or UserControl in XAML (C#). This means that when I create the template for the xaml file, it also automatically creates a .cs file that is the direct child of the xaml file in the solution explorer tree. Is this possible in the Rider settings?

0
Comment actions Permalink

Lazar, 

unfortunately, multi-file templates are not available in Rider at this moment. 

Please, try this manual. So, you can find some examples like this. When you create a file from the template, variables will be replaced automatically. 

Please, let me know if you will need more help with this. 

0

Please sign in to leave a comment.