无法使用单声道加载文件或程序集 System.Net.Http

Could not load file or assembly System.Net.Http using mono

我正在用 C# 开发一个 discord 机器人并让它全天候 24/7 我计划用单声道将它托管在 pi 零中,因为零不能 运行 net core

我正在使用 visual studio 2019 使其以 .NET Framework 4.6.2 为目标,编译后我得到一个带有 exe 和一堆 dll 库的 Release 文件夹,然后尝试 运行使用

在我的 pi 中编程
mono 'discord bot net framework.exe'

在我的 windows 10 PC 中它工作正常但是当我尝试在 pi 上 运行 它时我收到以下错误:

Unhandled Exception: System.TypeLoadException: Could not load type of field 'Discord.Net.Rest.DefaultRestClient:_client' (1) due to: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. at Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordRestApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, System.String userAgent, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordSocketApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, Discord.Net.WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.DiscordSocketClient.CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Discord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x0001e] in :0 at Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program. (System.String[] args) [0x0000c] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type of field 'Discord.Net.Rest.DefaultRestClient:_client' (1) due to: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. at Discord.API.DiscordRestApiClient.SetBaseUrl (System.String baseUrl) [0x00011] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordRestApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, System.String userAgent, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x0006a] in <790e6351624946dea6c24efa0b8ebeb3>:0 at Discord.API.DiscordSocketApiClient..ctor (Discord.Net.Rest.RestClientProvider restClientProvider, Discord.Net.WebSockets.WebSocketProvider webSocketProvider, System.String userAgent, System.String url, Discord.RetryMode defaultRetryMode, Newtonsoft.Json.JsonSerializer serializer, Discord.RateLimitPrecision rateLimitPrecision, System.Boolean useSystemClock) [0x00021] in :0 at Discord.WebSocket.DiscordSocketClient.CreateApiClient (Discord.WebSocket.DiscordSocketConfig config) [0x00020] in :0 at Discord.WebSocket.DiscordSocketClient..ctor (Discord.WebSocket.DiscordSocketConfig config) [0x00000] in :0 at Not_traso.StartUp.ConfigureServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services) [0x00015] in :0 at Not_traso.StartUp.RunAsync () [0x0001e] in :0 at Not_traso.StartUp.RunAsync (System.String[] args) [0x00065] in :0 at Not_traso.Program.Main (System.String[] args) [0x00060] in :0 at Not_traso.Program. (System.String[] args) [0x0000c] in :0

我用 sudo apt install mono-complete 安装了 mono 并更新到最新版本,

运行ning mono --version 给出

Mono JIT 编译器版本 6.12.0.122(tarball Mon Feb 22 17:44:05 UTC 2021)
版权所有 (C) 2002-2014 Novell, Inc、Xamarin Inc 和贡献者。 www.mono-project.com
TLS:__thread
SIGSEGV:正常
通知:epoll
架构:armel,vfp+hard
禁用:none
杂项:软调试
口译员:是
LLVM:是(610)
暂停:抢先
GC:sgen(默认并发)

我已经尝试安装 System.Net.Http 与 NuGet 最新版本和一些以前的版本,但它不起作用

我以前没有用过 pi 或 Linux,所以我什至不知道去哪里寻找丢失的库或做什么

原来 discord net 不支持单声道,所以我无能为力,哦,好吧。