gpt4 book ai didi

.net - Linux 上的 ildasm 通过 nuget 安装 : ildasm executable not found

转载 作者:行者123 更新时间:2023-12-04 10:48:20 24 4
gpt4 key购买 nike

我通过在我的 Ubuntu 18.04 上安装了 ildasm

nuget install Microsoft.NETCore.ILDAsm

我以某种方式结束了两个目录:
/home/vagrant/.nuget/packages/microsoft.netcore.ildasm/2.0.8/
/home/vagrant/Microsoft.NETCore.ILDAsm.2.0.8/

但它们都不包含任何 dll 或 exe:
vagrant@ubuntu1804:~/Microsoft.NETCore.ILDAsm.2.0.8$ ls
LICENSE.TXT Microsoft.NETCore.ILDAsm.2.0.8.nupkg
Microsoft.NETCore.ILDAsm.nuspec _rels runtime.json THIRD-PARTY-NOTICES.TXT
version.txt

nuget 将主应用程序放在哪里,即相当于 Windows 上的 ildasm.exe?

还是我在 Linux 上安装 ildasm 做错了什么?

最佳答案

让我们考虑两种安装 ildasm 的方法。
使用 nuget 包

  • 定义 RID (运行时标识符)

  • dotnet --info

    # execution result
    ..
    Runtime Environment:
    OS Name: ubuntu
    OS Version: 18.04
    OS Platform: Linux
    RID: ubuntu.18.04-x64 # <----
    ..
  • 下载包运行时。{RID}.Microsoft.NETCore.ILDAsm。就我而言,它是:runtime.ubuntu.18.04-x64.Microsoft.NETCore.ILDAsm
  • 解压缩它并提取可执行文件'/runtimes/{RID}/native/ildasm'
  • 授予它执行权限并复制到 .NET 运行时文件夹(调用 dotnet --list-runtimes 列出运行时)

  • chmod +x ildasm
    sudo mv ildasm /usr/share/dotnet/shared/Microsoft.NETCore.App/{version}/
  • 创建符号链接(symbolic link)

  • ln -s /usr/share/dotnet/shared/Microsoft.NETCore.App/{version}/ildasm ildasm
  • 运行 ildasm

  • ./ildasm {path}/project.dll >> {path}/project.il
    相同的步骤适用于 ilasm .
    使用 dotnet-ildasm工具
    # install .net core runtime if required
    # sudo apt-get update; \
    # sudo apt-get install -y apt-transport-https && \
    # sudo apt-get update && \
    # sudo apt-get install -y dotnet-runtime-3.0

    # find required tool
    dotnet tool search ildasm
    # output:
    # Package ID Latest Version Authors Downloads Verified
    # ---------------------------------------------------------------------------
    # dotnet-ildasm 0.12.2 pjbgf 100154
    # dotasm 1.0.1 DotAsm 434

    # install tool
    dotnet tool install -g dotnet-ildasm
    将 IL 输出到文件:
    # go to project folder
    cd ../project/bin/Debug/netx.x

    dotnet ildasm program.dll -o program.il

    关于.net - Linux 上的 ildasm 通过 nuget 安装 : ildasm executable not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59595350/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com