Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add a new c# file to a project using dotnet-cli

I'm learning how to use dotnet-cli with VSCode. I've seen many commands on how to create solution, projects, add reference to projects... but I don't see anywhere in the documentation how to add a file. If remember, in RubyOnRails it was possible to add file from the command line.

Thanks for helping

like image 958
Richard77 Avatar asked Mar 03 '18 18:03

Richard77


People also ask

How do I create a new C project?

From the menu bar, click File > New > Project. In the Select a wizard window, expand C/C++, select C++ Project, and then click Next. In the Create a C++ Project window, in the Project name field, enter a name for the C++ project. From the Project type list, select Makefile Project/Empty Project, and then click Finish.

How do I add C files to Visual Studio?

In the Solution Explorer, right click 'Source Files', choose 'Add' and 'New item' to add a new item. Select 'Visual C++' and 'C++ File(. cpp)'. Change the file extension from .

Can you include a .C file in C?

You can properly include . C or . CPP files into other source files.


1 Answers

Not that I know of (I was also researching that topic) but I found helpful extension for VS code called C# Extensions by jchannon, which helps you create classes and interfaces with correct namespace by right-clicking the folder in VS code explorer and selecting to create C# class or C# interface.

like image 141
Andrey Zhilyakov Avatar answered Sep 24 '22 11:09

Andrey Zhilyakov