12

Ubuntu build .Net Core App

 2 years ago
source link: https://sskaje.me/2021/06/ubuntu-build-net-core-app/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Ubuntu build .Net Core App

Ubuntu 20.04,打算build Il2cppDumper 6.2.2 的 .Net Core 版本,因为作者没有上传二进制到releases里。

参考微软官方文档:https://docs.microsoft.com/zh-cn/dotnet/core/install/linux-ubuntu

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1 dotnet-sdk-5.0

环境装好后,准备仓库

git clone https://github.com/Perfare/Il2CppDumper.git
git clone https://github.com/sskaje/EnumExtractor.git

Build 直接用 dotnet publish 完成

cd Il2cppDumper
dotnet publish --output ../out --framework netcoreapp3.1
cd ../EnumExtractor
dotnet publish --output ../out

因为 Il2cppDumper 作者支持了多个framework,如果不指定就会报下边类似的错误

/usr/share/dotnet/sdk/5.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CrossTargeting.targets(27,5): error NETSDK1129: The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, you must specify the framework for the published application. [/opt/tools/il/Il2CppDumper/Il2CppDumper/Il2CppDumper.csproj]

由于在 Linux 上build的,所以直接输出了可以执行的二进制文件(ELF,也+x了),不需要从github上下载之后用 dotnet 启动 dll 去执行了,dotnet 执行的方法也很简单

dotnet Il2cppDumper.dll
Ubuntu build .Net Core App by @sskaje: https://sskaje.me/2021/06/ubuntu-build-net-core-app/
Link to this post!

Author sskajePosted on June 5, 2021June 5, 2021Categories 杂七杂八Tags dotnet, dotnetcore


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK