Friday, April 14, 2017

Creating a .NET Core project using Command-Line Interface Tools

I love IDEs but normally you don’t get to learn a lot of things about internals if you use the IDE. How about creating a .NET project using notepad? Sounds interesting….

Yes, let’s create our first .NET Core project using Command-Line Interface tools without any IDE.

Open the Command Prompt and navigate to the folder path where you would like to create the new .NET Core project.

Create a new folder named “NETCore”.

CmdLine1

Create a new folder named “FirstCoreApp” and navigate to the folder

CmdLine2

Type “dotnet new”

CmdLine3

You can see the C# project got created successfully with 2 files. Program.cs and Project.json Note: Project.json will be seen only if you have .NET Core Tools preview 2 and below. From .NET Core Tools preview 3 onwards you will see FirstCoreApp.csproj file.

CmdLine4

Program.cs file contents will be similar to the contents when creating a console application using the VS IDE

You can build the application at command line using the command “dotnet restore”

CmdLine6

You can then run the application using the command “dotnet run”

CmdLine7

Now we have successfully created a .NET Core application just using Command Line Tools without any IDE.

Technorati Tags: ,

No comments:

Post a Comment