"runreadytoruncompiler" .net core 3.1 发布单文件项目时出错
"runreadytoruncompiler" error with .net core 3.1 when publishing a single file probject
我有一个以这种方式构建的 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]
这个错误是什么意思?
我有另一个项目,我使用完全相同的命令行构建,没有任何问题。
如果我删除单个文件属性,那么它将正确构建。
如何解决这个问题?错误消息并没有真正向我解释发生了什么。
将此添加到项目文件以修复 JavaScriptEncoder:
<TrimmerRootAssembly Include="System.Text.Encodings.Web" />
这是 IResourceWriter 的:
<TrimmerRootAssembly Include="System.Resources.Writer" />
ReadyToRun 有时需要有关包含内容的帮助(或只是错误),您可以阅读更多内容 here
我有一个以这种方式构建的 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]
这个错误是什么意思?
我有另一个项目,我使用完全相同的命令行构建,没有任何问题。
如果我删除单个文件属性,那么它将正确构建。
如何解决这个问题?错误消息并没有真正向我解释发生了什么。
将此添加到项目文件以修复 JavaScriptEncoder:
<TrimmerRootAssembly Include="System.Text.Encodings.Web" />
这是 IResourceWriter 的:
<TrimmerRootAssembly Include="System.Resources.Writer" />
ReadyToRun 有时需要有关包含内容的帮助(或只是错误),您可以阅读更多内容 here