时间:2022-08-01 10:48:50 | 栏目:.NET代码 | 点击:次
引言: .NET Core 源码编译
https://github.com/dotnet
git clone https://github.com/dotnet/runtime.git
./build -subset Clr ./build -subset Libs ./build -subset Installer
1.Ubuntu 18.04 LTS (Docker/虚拟机/vps) 内存至少1G
2.环境:
# 1. 安装以下软件包 sudo apt-get update sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget # 2. 获取签名密钥 wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - # 3. 将kitware存储库添加到源列表并进行更新。 sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' sudo apt-get update # 4. 安装 kitware 密钥更新包 sudo apt-get install kitware-archive-keyring # 5. 依赖软件包 sudo apt-get install cmake llvm-9 clang-9 autoconf automake libtool build-essential python curl git lldb-6.0 liblldb-6.0-dev libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libssl-dev libnuma-dev libkrb5-dev # 编码(可选) bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) apt-get install locales
3.克隆源码仓库
4.编译指令:
./build -subset Clr ./build -subset Libs ./build -subset Installer
5.安装运行时:
# 在/usr/share创建dotnet目录 mkdir -p /usr/share/dotnet # 接着,解压运行时的二进制压缩包,到这个新创建的目录 tar zxf /home/runtime/artifacts/packages/Debug/Shipping/dotnet-runtime-5.0.0-dev-linux-x64.tar.gz -C /usr/share/dotnet # 创建软连接到bin目录 ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet # 测试 dotnet --info
6.SDK 安装:
# 首先,将 微软 的包签名密钥,添加到受信任密钥列表 wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb # 然后,添加包存储库 dpkg -i packages-microsoft-prod.deb # 更新源 apt-get update # 安装.NET SDK 3.1 apt-get install -y dotnet-sdk-3.1 # 看一下版本信息 dotnet --info