【问题标题】:"runreadytoruncompiler" error with .net core 3.1 when publishing a single file probject.net core 3.1 发布单个文件 probject 时出现“runreadytorunco​​mpiler”错误
【发布时间】:2021-04-10 01:02:30
【问题描述】:

我有一个这样构建的 F# 项目:

dotnet publish --nologo -r osx-x64 -c Release --self-contained true /p:PublishSingleFile=true /p:PublishTrimmed=true /p:PublishReadyToRun=true

我得到了这样的页面:

RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Resources.IResourceWriter' from assembly 'System.Text.RegularExpressions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. while resolving 0x10000ce - System.Resources.IResourceWriter. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.JavaScriptEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0x2000045 - System.Text.Json.JsonWriterOptions. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.JavaScriptEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0x2000046 - System.Text.Json.Utf8JsonWriter. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.JavaScriptEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0x1000011 - System.Text.Encodings.Web.JavaScriptEncoder. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.TextEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0x10000ad - System.Text.Encodings.Web.TextEncoder. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.TextEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0xa00023c - System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncodeUtf8. [/Users/thomas/Projects/test/test.fsproj]
RUNREADYTORUNCOMPILER : warning : Could not load type 'System.Text.Encodings.Web.TextEncoder' from assembly 'System.Memory, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. while resolving 0xa00023f - System.Text.Encodings.Web.TextEncoder.FindFirstCharacterToEncode. [/Users/thomas/Projects/test/test.fsproj]

这个错误是什么意思?

我有另一个项目,我使用完全相同的命令行构建,没有任何问题。

如果我删除单个文件属性,那么它将正确构建。

如何解决这个问题?错误消息并没有真正解释我发生了什么。

【问题讨论】:

    标签: .net-core publishing


    【解决方案1】:

    将此添加到项目文件以修复 JavaScriptEncoder:

    <TrimmerRootAssembly Include="System.Text.Encodings.Web" />
    

    这适用于 IResourceWriter:

    <TrimmerRootAssembly Include="System.Resources.Writer" />
    

    ReadyToRun 有时需要帮助(或者只是错误),您可以阅读更多信息here

    【讨论】:

      猜你喜欢
      • 2020-04-08
      • 2021-09-20
      • 1970-01-01
      • 2021-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-22
      • 2017-05-02
      相关资源
      最近更新 更多