dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.75k stars 1.07k forks source link

Feature Request : dotnet add file -lang [C#/F#] [MyClass/MyScript] #10336

Open ykafia opened 5 years ago

ykafia commented 5 years ago

Context :

adding a class file/script file to the project. I'm currently using Ionide for F# and a 3rd party extension of VsCode to add a C# class file. Else i'm forced to add the file manually and rewrite the boilerplate code (usings and namespaces)

Possible use :

C#

dotnet add file -lang C# MyClass

F#

dotnet add file -lang F# MyScript
livarcocc commented 5 years ago

cc @KathleenDollard

KathleenDollard commented 5 years ago

@Jaygem Have you explored custom templates? They would allow creation of the file. Since C# uses globbing, that should be sufficient to add it to the project. Does C# also use globbing?

You would access this via

dotnet new <your template name> 

Let me know if I misunderstand the request.

ykafia commented 5 years ago

I haven't yet explored custom templates, I'm not sure what is globbing.

To explain the use case :

In visual studio, if I want to add a class file i use ctrl+shift+A, select "Add a class file", type the name and the file is created. I'm not sure if custom templates could achieve the same result.

KathleenDollard commented 5 years ago

Thanks for the clarification.

@peterhuene This sounds like a request for a template that is an empty class file. Would you like to mark this as a good first issue or move it to dotnet/template, or something else.

There might be more complexity, but it sounds like a variation of the global.json and other templates.