当前位置:网站首页>.NET Application -- Helloworld (C#)
.NET Application -- Helloworld (C#)
2022-08-05 03:05:00 【DXB2021】
安装 .NET and create your first app.
下载.NET SDK(Software development installation package)
打开Windows PowerShell,输入命令行dotnet.
dotnet
运行结果如下:

如果安装成功,You should see output similar to the above.
创建应用:
在命令提示符下,Run the following command to create the app:
dotnet new console -o MyApp -f net6.0Then navigate to the new directory created by the previous command:
cd MyApp
What do these commands represent?
dotnet new consoleThe command will create a new console application for you.-oParameters are created namedMyApp的目录,Used to store apps and populate them with required files.-fThe parameter indicates that you are creating .NET 6 应用程序.- 命令
cd MyAppwill change the current directory to the directory just created for the new app.




Windows PowerShell的代码如下:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#> dotnet new console -o MyApp -f net6.0
欢迎使用 .NET 6.0!
---------------------
SDK 版本: 6.0.302
遥测
---------
.NET 工具会收集用法数据,帮助我们改善你的体验.它由 Microsoft 收集并与社区共享.你可通过使用喜欢的 shell 将 DOTNET_CLI_TELEMETRY_OPTOUT 环境变量设置为 "1" 或 "true" 来选择退出遥测.
阅读有关 .NET CLI 工具遥测的更多信息: https://aka.ms/dotnet-cli-telemetry
----------------
已安装 ASP.NET Core HTTPS 开发证书.
若要信任该证书,请运行 "dotnet dev-certs https --trust" (仅限 Windows 和 macOS).
了解 HTTPS: https://aka.ms/dotnet-https
----------------
编写你的第一个应用: https://aka.ms/dotnet-hello-world
查找新增功能: https://aka.ms/dotnet-whats-new
浏览文档: https://aka.ms/dotnet-docs
在 GitHub 上报告问题和查找源: https://github.com/dotnet/core
使用 "dotnet --help" 查看可用命令或访问: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
已成功创建模板“控制台应用”.
正在处理创建后操作...
在 C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\MyApp\MyApp.csproj 上运行 “dotnet restore”...
正在确定要还原的项目…
已还原 C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\MyApp\MyApp.csproj (用时 122 ms).
已成功还原.
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#> cd MyApp
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\MyApp> notepad
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\MyApp> notepad Program.cs
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\C#\MyApp>Program.cs的代码如下:
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
运行应用:
在命令提示符下,运行以下命令:
dotnet run

编辑代码:

Program.cs的代码如下:

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Console.WriteLine("The current time is "+DateTime.Now);Congrats on building and running your first one .NET 应用!
边栏推荐
- 龙蜥社区第二届理事大会圆满召开!理事换届选举、4 位特约顾问加入
- QT MV\MVC结构
- Linux下常见的开源数据库,你知道几个?
- 剑指offer专项突击版第20天
- HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
- Solve the problem of port occupancy Port xxxx was already in use
- 【 genius_platform software platform development 】 : seventy-six vs the preprocessor definitions written cow force!!!!!!!!!!(in the other groups conding personnel told so cow force configuration to can
- post-study program
- [机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
- Syntax basics (variables, input and output, expressions and sequential statement completion)
猜你喜欢

毕设-基于SSM房屋租赁管理系统

2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from

Gantt chart is here, project management artifact, template is used directly

Multithreading (2)

A small tool to transfer files using QR code - QFileTrans 1.2.0.1

The Tanabata copywriting you want has been sorted out for you!

Access Characteristics of Constructor under Inheritance Relationship

QT MV\MVC结构

Intersection of Boolean Operations in SuperMap iDesktop.Net - Repairing Complex Models with Topological Errors

mysql没法Execute 大拿们求解
随机推荐
【Daily Training】1403. Minimum Subsequence in Non-Increasing Order
1667. 修复表中的名字
Tencent Cloud [Hiflow] New Era Automation Tool
Review 51 MCU
sql server installation prompts that the username does not exist
【软件测试】自动化测试之unittest框架
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
Flink 1.15.1 Cluster Construction (StandaloneSession)
private封装
QT MV\MVC结构
2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
What should I do if the self-incrementing id of online MySQL is exhausted?
lua学习
The 20th day of the special assault version of the sword offer
shell statement to modify txt file or sh file
北斗三号短报文终端露天矿山高边坡监测方案
Talking about data security governance and privacy computing
你要的七夕文案,已为您整理好!
The usage of try...catch and finally in js
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)