第 3 章 使用 .NET 7.0 创建应用程序
了解如何创建 C# hello-world
应用程序。
流程
在名为
my-app
的目录中创建一个新的 Console 应用程序:$ dotnet new console --output my-app
输出返回:
The template "Console Application" was created successfully. Processing post-creation actions... Running 'dotnet restore' on my-app/my-app.csproj... Determining projects to restore... Restored /home/username/my-app/my-app.csproj (in 67 ms). Restore succeeded.
从模板创建一个简单的
Hello World
控制台应用。应用程序存储在指定的my-app
目录中。
验证步骤
运行项目:
$ dotnet run --project my-app
输出返回:
Hello World!