![](/img/trans.png)
[英]How do I to fix IntelliSense in VSCode not working and OmniSharp error messages when loading unity C# scripts?
[英]Omnisharp C# Not Working on Ubuntu 22.04 with Unity
由于 Windows 每天给我带来新的问题,我永久地转向 Linux(Kubuntu 22.04 LTS)。 但是在使用 Unity Editor 时,VS Code 并没有为我提供 Intellisense。
在我的系统中: mono-complete
dotnet-sdk-6.0 && aspnetcore-runtime-6.0
包
在 VS Code 中:安装了“C# 扩展”
案例一:-
omnisharp.useModernNet: false
输出:
Starting OmniSharp server at 26/6/2022, 2:58:43 pm
Target: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln
OmniSharp server started with Mono 6.8.0.
Path: /home/anany-aadil/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0/omnisharp/OmniSharp.exe
PID: 34448
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on ubuntu 22.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 0 MSBuild instance(s)
Could not locate MSBuild instance to register with OmniSharp.
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
案例2 :-
omnisharp.useModernNet:真
输出:
Starting OmniSharp server at 26/6/2022, 3:10:09 pm
Target: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln
OmniSharp server started with .NET 6.0.301
.
Path: /home/anany-aadil/.vscode/extensions/ms-dotnettools.csharp-1.25.0-linux-x64/.omnisharp/1.39.0-net6.0/OmniSharp.dll
PID: 35601
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: .NET Core SDK 6.0.301 17.2.0 - "/usr/share/dotnet/sdk/6.0.301/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.301 17.2.0 - "/usr/share/dotnet/sdk/6.0.301/"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/3D Shooter.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/home/anany-aadil/Desktop/UnityProjects/3D Shooter'.
[info]: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/home/anany-aadil/Desktop/UnityProjects/3D Shooter' on host 35481.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj'.
/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
/usr/share/dotnet/sdk/6.0.301/Microsoft.Common.CurrentVersion.targets(1221,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file '/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj'.
/home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj
/usr/share/dotnet/sdk/6.0.301/Microsoft.Common.CurrentVersion.targets(1221,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: /home/anany-aadil/Desktop/UnityProjects/3D Shooter/Assembly-CSharp-Editor.csproj
任何修复? 谢谢
好的,我已经解决了这个问题。
我所做的是删除dotnet
(sdk 和运行时)的 Microsoft 包并安装 snap 版本。
而且我还完全删除了mono-complete
并再次安装它,瞧! 现在可以用了谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.