![](/img/trans.png)
[英]Unity/C# - Compiler Errors ONLY in VSCode, not Unity Editor or Visual Studio
[英]Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors
我已升級到最新的 Unity 版本 (Unity 2019.3.0a7),但在不同的文件中出現了大量相同的錯誤。
我與我合作的朋友也運行相同的版本,但沒有錯誤。
其中有兩個,每個引用不同的包,但都引用每個包內的多個錯誤。
錯誤大致如下:
(R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.
error CS1504: Source file 'D:\[...]\[UnityProject]\Library\PackageCache\com.unity.test-framework@1.0.16\UnityEngine.TestRunner\NUnitExtensions\Commands\BeforeAfterTestCommandState.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.
和
Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.
error CS1504: Source file 'C:\Program Files\Unity\Hub\Editor\2019.3.0a7\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\UIBehaviour.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.
在控制台中的相應錯誤日志中報告了大約 15-20 個這些錯誤,但所有關於拋出異常的內容都相同(相同的錯誤代碼)。
我以前從未見過這個錯誤,我在網上找不到任何幫助。 我所有的包裹都是最新的。 我不知所措。
我非常感謝有關如何解決此問題的任何建議。
由於 Windows 注冊表中殘留的工件,卸載 Anaconda 和 Python 可能會導致此類問題。
就我而言,刪除注冊表編輯器中的以下鍵有效:
計算機\\HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun
它的目標是在 Anaconda 卸載過程中刪除的文件。
Library
文件夾 它應該工作。 如果不是,則您的Unity版本可能存在一些錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.