[英]How do I to fix IntelliSense in VSCode not working and OmniSharp error messages when loading unity C# scripts?
I have installed VSCode, the C# extension for VSCode, via the extensions panel.我已经通过扩展面板安装了 VSCode,即 VSCode 的 C# 扩展。 I then installed .NET 5.0 from the Microsoft website.
然后我从 Microsoft 网站安装了 .NET 5.0。 Finally, I installed the Unity hub and Unity.
最后,我安装了 Unity hub 和 Unity。 Unity booted I went into the Preferences menu (a submenu within Edit) and in External Tools set the script editor to Visual Studio Code.
Unity 启动后,我进入了 Preferences 菜单(Edit 中的一个子菜单)并在 External Tools 中将脚本编辑器设置为 Visual Studio Code。 I started following a tutorial to learn the basics, but when I created a script and opened it in VSCode I got the following error messages in the OmniSharp log:
我开始按照教程学习基础知识,但是当我创建脚本并在 VSCode 中打开它时,我在 OmniSharp 日志中收到以下错误消息:
[fail]: OmniSharp.MSBuild.ProjectLoader
The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this,
install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your
application.
You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'c:\Users\richa\BrackeysTutorial\Assembly-CSharp.csproj'.
c:\Users\richa\BrackeysTutorial\Assembly-CSharp.csproj
c:\Users\richa\.vscode\extensions\ms-dotnettools.csharp-1.23.9\.omnisharp\1.37.7-
beta.23\.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1180,5): Error: The reference
assemblies for .NETFramework,Version=v4.7.1 were not found.
To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or
retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Users\richa\BrackeysTutorial\Assembly-CSharp.csproj
This result of this was that IntelliSense didn't work and I got various other errors in the log when I started typing.这样做的结果是 IntelliSense 不起作用,当我开始打字时,我在日志中遇到了各种其他错误。 What is the best way to fix this problem?
解决此问题的最佳方法是什么?
I solved the problem by installing the developer pack 4.7.1 as the error message suggested from this site.我通过安装开发人员包 4.7.1 作为该站点建议的错误消息解决了该问题。 I tried a couple of things before this, like changing OmniSharp settings, but that didn't work.
在此之前我尝试了几件事,比如更改 OmniSharp 设置,但没有奏效。 Unfortunately, this may not work for Mac or Linux users.
不幸的是,这可能不适用于 Mac 或 Linux 用户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.