简体   繁体   English

加载统一 C# 脚本时,如何修复 VSCode 中的 IntelliSense 不起作用和 OmniSharp 错误消息?

[英]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.

相关问题 Intellisense 在 VSCode 中不起作用 - OmniSharp 错误 - Intellisense not working in VSCode - OmniSharp Error c# omnisharp intellisense 不适用于 vscode 中的 net 5.0(Windows 10) - c# omnisharp intellisense not working with net 5.0 in vscode (windows 10) c# Intellisense for unity 在 vscode 中不起作用 - c# Intellisense for unity is not working in vscode VScode 中的 Unity intellisense 不工作,Omnisharp 给出多个错误和警告 - Unity intellisense in VScode not working and Omnisharp is giving multiple errors and warnings 当 select 第二个项目时,在 VsCode C# (Omnisharp) 中出现错误 - Getting error in VsCode C# (Omnisharp) when select the second project Omnisharp C# 无法在带有 Unity 的 Ubuntu 22.04 上运行 - Omnisharp C# Not Working on Ubuntu 22.04 with Unity 如何在 Linux/Ubuntu 上的 VSCode for Unity 中获得 C# 脚本的代码完成? - How do i get code completion for C# scripts in VSCode for Unity on Linux/Ubuntu? 如何修复 Visual Studio 将 C# Unity 脚本视为杂项,因此无法自动完成? - How do I fix Visual Studio Treating C# Unity Scripts as Miscellaneous, and thus not autocompleting? 无法在Unity3D内部的C#编码脚本中实例化byte []数组; 我该如何解决? - Cannot Instantiate byte[] array in C# coding scripts inside Unity3D; How do I fix that? 当我通过统一打开 c# 脚本时,Visual Studio 没有给出提示(智能感知), - Visual studio not giving Hints (intellisense) when i opening the c# scripts through unity,
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM