Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I actually create a .NET Core project in Visual Studio?

Maybe this is super obvious and I just can't find it but how can I create a .NET Core project in Visual Studio (2015 or, preferably, 2013)? I just want to run a console application on a Linux machine. The documentation at on the .NET Core github page is incomplete and anything from Microsoft provides little-to-no help.

Bonus points if you can also tell me an easier way to run the application from my Linux command line other than dotnet run while sitting in the directory of the application.

like image 200
Brandon Avatar asked Mar 17 '16 17:03

Brandon


People also ask

How do I create a .NET Core project in Visual Studio code?

Open the project folder in VS Code. Wait for the C# extension to prompt you to add required assets for build and debug, and choose Yes. You can also open the Command Palette (Ctrl+Shift+P) and use the . NET: Generate Assets for Build and Debug command.

How do I get .NET Core in Visual Studio?

NET Core can be installed in two ways: By installing Visual Studio 2017/2019 or by installing . NET Core Runtime or SDK. . NET Core installer already contains ASP.NET Core libraries, so there is no separate installer for ASP.NET Core.


1 Answers

.NET Core templates are available in Visual Studio 2017. When installing VS2017, you have to pick the ".NET Core cross-platform development" workload. Once you do, you'll have access to the templates:

  1. Click File - New Project.
  2. Expand Visual C# - .NET Core on the left side.
  3. Pick one of the templates.

.NET Core templates in Visual Studio 2017


If you're on Visual Studio 2015, make sure you install Update 3 (or later) and the .NET Core SDK. Then the templates will show up in New Project:

New .NET Core Project in Visual Studio 2015


It's also possible to scaffold new applications on the command line, using either dotnet new (included with the .NET Core SDK), or yo aspnet:

# Create a new console app dotnet new  # Create a new web (ASP.NET Core) application dotnet new -t web  # Use generator-aspnet via yeoman yo aspnet 
like image 96
Nate Barbettini Avatar answered Sep 22 '22 15:09

Nate Barbettini