关键字 dotNet
dotnet
difference between .net/.net framework/C#
- C#是Microsoft开发的一种编程语言(和c,asm,java,Python一样),其前身就是一路从C->c++>C#逐渐升级过来的,有很多相似性,但是互相之间又很多不同。
- .NET framwork是Microsoft的软件开发框架,主要针对Microsoft Windows操作系统运行。.NET Framework只是一套工具(最常见的就是Visual Studio)和库,可帮助开发人员快速,轻松地开发安全的软件应用程序。可以使用 C#、F# 或 Visual Basic ,Python等编写 .NET 应用
- .net是.NET framwork的升级版本,主要用于开发跨平台(windo,linux,macos等)的应用。
.NET 为跨平台框架,可在 Linux、macOS 和 Windows 上运行。.NET Framework 仅在 Windows 上运行.
微软官方解释:
发展顺序:.net framework ->.net core ->.net
微软官方对.net的定义:
NET 是免费的。不收取任何费用或许可成本,包括商业用途。
.NET 是开源的、跨平台的,且具有适用于 Windows, Linux, and macOS 的免费开发工具。
version
7
download and install
linux
https://learn.microsoft.com/zh-cn/dotnet/core/install/linux-scripted-manual?source=recommendations
DOTNET_FILE=dotnet-sdk-7.0.100-linux-x64.tar.gz
export DOTNET_ROOT=/opt/tools/dotnet7
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools:/root/.dotnet/tools
windows
visit https://dotnet.microsoft.com/zh-cn/download/dotnet/7.0 and search Windows and click x64, target exe is like dotnet-sdk-7.0.401-win-x64.exe
quiet install: dotnet-sdk-7.0.401-win-x64.exe /install /quiet /norestart
you can use dotnet command in cmd after dotnet-sdk-7.0.xxx-win-x64.exe was installed.
in ‘vs code’
- vscode
- ‘c#’ extension
project
cui project
dotnet new console -o MyApp -f net7.0
dotnet run
dotnet build
web project
dotnet new blazorserver -o BlazorApp –no-https -f net7.0
dotnet watch
web rest api project
dotnet new webapi –no-https -o rest-api-app -f net7.0
dotnet run
curl -XGET https://localhost:5000/weatherforecast
dotnet tool install -g Microsoft.dotnet-httprepl
Controller 派生自 ControllerBase,并添加了对视图的支持,因此它用于处理网页,而不是 Web API 请求。
rm -rf ./release-output
dotnet clean
dotnet publish -c Release -o ./release-output
dotnet publish -r linux-x64 /p:PublishSingleFile=true
发布
rm -rf ./out/
docker run –rm -v $(pwd):/app -w /app mcr.microsoft.com/dotnet/sdk:7.0 dotnet publish -c Release -o out /p:PublishSingleFile=true
rm -rf /tmp/rest-api0-v0.0.1
mv ./out /tmp/rest-api0-v0.0.1
问题
q: Process terminated. Couldn’t find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
a: yum install libicu -y
最后编辑:admin 更新时间:2025-09-19 10:08