c# - 无法使用 .NET Core 在 Raspbian 上加载文件或程序集 'System.Diagnostics.DiagnosticSource'

标签 c# .net-core raspberry-pi raspbian

我正在尝试在 Raspberry Pi 上部署应用程序。我已经安装了 .NET Core 运行时,但在执行时出现此错误:

    Unhandled Exception:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'System.Diagnostics.DiagnosticSource, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.ApplyServices (Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions options, Microsoft.Extensions.DependencyInjection.ServiceCollection services) [0x0003f] in <e66a1f96e9734a7fac7cea0901022728>:0 
  at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache+<>c__DisplayClass4_0.<GetOrAdd>b__2 (System.Int64 k) [0x000fe] in <e66a1f96e9734a7fac7cea0901022728>:0 
  at (wrapper delegate-invoke) System.Func`2[System.Int64,System.ValueTuple`2[System.IServiceProvider,System.Collections.Generic.IDictionary`2[System.String,System.String]]].invoke_TResult_T(long)
  at System.Collections.Concurrent.ConcurrentDictionary`2[TKey,TValue].GetOrAdd (TKey key, System.Func`2[T,TResult] valueFactory) [0x00034] in <69599a71bc4d4cd3a8a6e4323fa57b86>:0 
  at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.GetOrAdd (Microsoft.EntityFrameworkCore.Infrastructure.IDbContextOptions options, System.Boolean providerRequired) [0x000b7] in <e66a1f96e9734a7fac7cea0901022728>:0 
  at Microsoft.EntityFrameworkCore.DbContext..ctor (Microsoft.EntityFrameworkCore.DbContextOptions options) [0x00051] in <e66a1f96e9734a7fac7cea0901022728>:0 
  at Microsoft.EntityFrameworkCore.DbContext..ctor () [0x00006] in <e66a1f96e9734a7fac7cea0901022728>:0 
  at XPathParserTest1.Model..ctor () [0x00000] in <51b90b049f2c424c9ef8e7dced3213d4>:0 
  at XPathParserTest1.Program.MainAsync (System.String[] args) [0x001a2] in <51b90b049f2c424c9ef8e7dced3213d4>:0 
  at XPathParserTest1.Program.Main (System.String[] args) [0x00015] in <51b90b049f2c424c9ef8e7dced3213d4>:0 

相同的项目文件在使用 SDK 的 Windows 上运行良好,而仅使用运行时清理 Windows。

我不知道发生了什么,我尝试了一些解决方案,包括编辑 csproj 文件和更改 nuget 依赖项。

最佳答案

对于 Raspbian,如果官方支持,最好为可执行文件生成 native 镜像

关于c# - 无法使用 .NET Core 在 Raspbian 上加载文件或程序集 'System.Diagnostics.DiagnosticSource',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54871903/

相关文章:

asp.net-core - 使 DNVM 使用全局设置(机器)

azure - 使用 pfx 文件时,Azure Function App 返回 'The credentials supplied to the package were not recognized'

c# - 如何在 .Net Core 中设置默认内部版本号

python - 启动应用程序时出现 Pyqt4 X 错误

c# - 不使用 Log() 查找位位置

c# - GridView 在显示模式下显示,但不在浏览器中显示 ASP.NET C#

c# - C# 类如何处理 JSON 中的美元符号?

c# - Azure Devops 无法运行 xUnit 测试

python - 无法让我的 python 脚本在启动时/从树莓派上的快捷方式运行

python - 无法使用 pyodbc 更新 sql 数据库表中的多个列