下载ZIP
Download .NET 7.0 (Linux, macOS, and Windows)
解压
创建项目
mkdir MyWebApp
cd MyWebApp
"C:\Users\90816\Downloads\dotnet-sdk-7.0.317-win-x64\dotnet.exe" new webapp -n MyWebApp
运行项目
"C:\Users\90816\Downloads\dotnet-sdk-7.0.317-win-x64\dotnet.exe" run
打包方式1
"C:\Users\90816\Downloads\dotnet-sdk-7.0.317-win-x64\dotnet.exe" publish -c Release
打包后的应用将打包到 bin/Release/net7.0/publish/
文件夹下,可以将其部署到任何支持 .NET 7 的环境中
运行打包出的包
cd bin/Release/net7.0/publish/
"C:\Users\90816\Downloads\dotnet-sdk-7.0.317-win-x64\dotnet.exe" MyWebApp.dll
打包方式2
打包为自包含(Self-contained)应用
"C:\Users\90816\Downloads\dotnet-sdk-7.0.317-win-x64\dotnet.exe" publish -c Release -r win-x64 --self-contained
./MyWebApp.exe