Unity 文件加载失败:“System.Threading.Tasks.Dataflow”
Posted
技术标签:
【中文标题】Unity 文件加载失败:“System.Threading.Tasks.Dataflow”【英文标题】:Unity file failed to load: "System.Threading.Tasks.Dataflow" 【发布时间】:2021-06-03 11:30:23 【问题描述】:这周我偶然遇到了一个阻止我继续工作的错误,我不知道如何解决它。我为一个 Unity 项目使用 VS Code,它告诉我
OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Users\jamie\Documents\Unity\Projects\OTHERWOODLY\Assembly-CSharp.csproj
问题是由错误日志中的这一行引起的,但我也会在帖子末尾发布整个错误:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我已尝试更新 .NET 并重新下载了最新版本的 Mono。我还在 VS Code 中将这些设置添加到我的 C# 设置中
"omnisharp.path": "latest",
"omnisharp.useGlobalMono": "always",
似乎没有什么可以解决它。在这里真的很茫然,如果有人有任何想法,我将不胜感激!
完整的错误信息:
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\jamie\Documents\Unity\Projects\OTHERWOODLY\Assembly-CSharp-Editor.csproj
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'c:\Users\jamie\Documents\Unity\Projects\OTHERWOODLY\Assembly-CSharp-Editor.csproj'.
c:\Users\jamie\Documents\Unity\Projects\OTHERWOODLY\Assembly-CSharp-Editor.csproj(0,0)
System.IO.FileNotFoundException: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Threading.Tasks.Dataflow, Version=4.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.Build.BackEnd.Logging.LoggingService.ProcessLoggingEvent(Object buildEvent, Boolean allowThrottling)
at Microsoft.Build.BackEnd.Logging.LoggingService.LogProjectEvaluationStarted(BuildEventContext projectEvaluationEventContext, String projectFile)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate()
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(IEvaluatorData`4 data, ProjectRootElement root, ProjectLoadSettings loadSettings, Int32 maxNodeCount, PropertyDictionary`1 environmentProperties, ILoggingService loggingService, IItemFactory`2 itemFactory, IToolsetProvider toolsetProvider, ProjectRootElementCacheBase projectRootElementCache, BuildEventContext buildEventContext, ISdkResolverService sdkResolverService, Int32 submissionId, EvaluationContext evaluationContext, Boolean interactive)
at Microsoft.Build.Evaluation.Project.ProjectImpl.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ProjectImpl.ReevaluateIfNecessary(EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ProjectImpl.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath, IReadOnlyDictionary`2 projectConfigurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 157
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath, IReadOnlyDictionary`2 configurationsInSolution) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectLoader.cs:line 75
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader, Guid sessionId, DotNetInfo dotNetInfo) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 116
at OmniSharp.MSBuild.ProjectManager.<>c__DisplayClass31_0.<LoadProject>b__0() in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 304
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in D:\a\1\s\src\OmniSharp.MSBuild\ProjectManager.cs:line 315
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
【问题讨论】:
这与Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.6.3.0有关吗(4小时前问)? @derHugo 看起来像,虽然发布的初始解决方案并没有为我解决。我没有 Visual Studio 社区或构建工具,我已将 VS Code 更新到最新版本。该错误仍然存在。 【参考方案1】:我相信我遇到了同样的问题,并通过下载 Visual Studio Build Tools 2019 https://visualstudio.microsoft.com/visual-cpp-build-tools/ 解决了它,然后用它来安装“.NET 桌面构建工具”。我没有包括任何可选选项。 然后我重新启动了VS Code,错误就消失了。
【讨论】:
以上是关于Unity 文件加载失败:“System.Threading.Tasks.Dataflow”的主要内容,如果未能解决你的问题,请参考以下文章
Mac版Rider加载编译.Net失败,Unity插件安装失败问题