Consider adding a class item template
See original GitHub issueAdd dotnet new class
dotnet new class
is an expected path to new users. Without it, we assume the user adds new .cs file through their file explorer or their editor. I’m contributing to docs to make this clearer, but ideally it’d be a simple command that creates a Class1.cs file in the current directory.
using System;
namespace <ParentFolder>
{
public class Class1
{
}
}
Customer filed issue on this.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:10 (7 by maintainers)
Top Results From Across the Web
visual studio - Cannot find Class template in Add New Item
I tried devenv /installvstemplates but this did not help. enter image description here. I think I may be missing something from this folder:....
Read more >Class template missing from Add Class
Right-click on Solution Explorer and select Add Class, the “Class” template is missing from Common Items in the Add New Item form.
Read more >Custom Item Templates in Visual Studio - YouTube
Have you ever found yourself starting a file out the same way every time in Visual Studio? Maybe you always add an empty...
Read more >Create item templates - Visual Studio (Windows)
Add an item template to the Add New Item dialog box. Create or open a project in Visual Studio. Add an item to...
Read more >Templates for projects and files - Visual Studio (Windows)
Item templates, such as code files, XML files, HTML pages, and Style Sheets, appear in the Project > Add New Item dialog box....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Mrxx99 ,
I moved your suggestion to a separate ticket for further discussion. The third point isn’t included due to existing parser restrictions and the ratio between gain/loss for the implementation.
Ah, for the parent directory, you mean the directory the project is being created in (class item in this case). That we can do, I was mis-thinking a directory one up in the path - which really makes no sense 😃. When niether the -o nor the -n option are provided, the current directory is implicitly used as the value of “name” parameter, which is usually used to replace the namespace. That’s a function of how the template is authored - easy enough to setup for this purpose.