text
stringlengths 0
13.4k
|
|---|
2.1.104
|
You can get more information about your platform with the --info flag:
|
dotnet --info
|
.NET Command Line Tools (2.1.104)
|
Product Information:
|
Version: 2.1.104
|
Commit SHA-1 hash: 48ec687460
|
Runtime Environment:
|
OS Name: Mac OS X
|
OS Version: 10.13
|
(more details...)
|
If you see output like the above, you're ready to go!
|
11
|
Hello World in C#
|
Hello World in C#
|
Before you dive into ASP.NET Core, try creating and running a simple C#
|
application.
|
You can do this all from the command line. First, open up the Terminal
|
(or PowerShell on Windows). Navigate to the location you want to store
|
your projects, such as your Documents directory:
|
cd Documents
|
Use the dotnet command to create a new project:
|
dotnet new console -o CsharpHelloWorld
|
The dotnet new command creates a new .NET project in C# by default.
|
The console parameter selects a template for a console application (a
|
program that outputs text to the screen). The -o CsharpHelloWorld
|
parameter tells dotnet new to create a new directory called
|
CsharpHelloWorld for all the project files. Move into this new directory:
|
cd CsharpHelloWorld
|
dotnet new console creates a basic C# program that writes the text
|
Hello World! to the screen. The program is comprised of two files: a
|
project file (with a .csproj extension) and a C# code file (with a .cs
|
extension). If you open the former in a text or code editor, you'll see this:
|
CsharpHelloWorld.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
|
12
|
Hello World in C#
|
<PropertyGroup>
|
<OutputType>Exe</OutputType>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
</PropertyGroup>
|
</Project>
|
The project file is XML-based and defines some metadata about the
|
project. Later, when you reference other packages, those will be listed
|
here (similar to a package.json file for npm). You won't have to edit this
|
file by hand very often.
|
Program.cs
|
using System;
|
namespace CsharpHelloWorld
|
{
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.