Problem
I am trying to use Unity on Ubuntu 18.04 using Visual Studio Code.
To set it up, I followed the steps put here:
https://medium.com/@sami1592/set-up-visual-studio-code-for-unity-in-linux-69b7f4352e0b
Some additional steps not mentioned in the article:
- I installed vscode with snap (from the software center) and redirected Unity's external coding program to it.
- I ran the installation commands while logged in as an administrator using su.
On the first day I was using this, I had no problems; Intellisense worked perfectly.
The next day, after I powered on my computer and opened my project, I found that Intellisense stopped working well.
VSCode output this error in the Omnisharp terminal:
Starting OmniSharp server at 11/4/2020, 4:51:19 PM Target: /home/fakeusername/Code/FakeProjectName/FakeProjectName.sln
OmniSharp server started. Path: /home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/run PID: 3364
Starting OmniSharp on ubuntu 18.4 (x64) info: OmniSharp.Services.DotNetCliService DotNetPath set to dotnet info: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 1 MSBuild instance(s) 1: StandAlone 16.8.0 - "/home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin" info: OmniSharp.MSBuild.Discovery.MSBuildLocator MSBUILD_EXE_PATH environment variable set to '/home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.exe' info: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 16.8.0 - "/home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin" CscToolExe = csc.exe MSBuildToolsPath = /home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin CscToolPath = /home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn BypassFrameworkInstallChecks = true MSBuildExtensionsPath = /home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.msbuild info: OmniSharp.Cake.CakeProjectSystem Detecting Cake files in '/home/fakeusername/Code/FakeProjectName'. info: OmniSharp.Cake.CakeProjectSystem Could not find any Cake files info: OmniSharp.MSBuild.ProjectSystem Detecting projects in '/home/fakeusername/Code/FakeProjectName/FakeProjectName.sln'. info: OmniSharp.MSBuild.ProjectManager Queue project update for '/home/fakeusername/Code/FakeProjectName/Assembly-CSharp.csproj' info: OmniSharp.Script.ScriptProjectSystem Detecting CSX files in '/home/fakeusername/Code/FakeProjectName'. info: OmniSharp.Script.ScriptProjectSystem Could not find any CSX files info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0 info: OmniSharp.MSBuild.ProjectManager Loading project: /home/fakeusername/Code/FakeProjectName/Assembly-CSharp.csproj info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110 info: OmniSharp.WorkspaceInitializer Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140 info: OmniSharp.WorkspaceInitializer Configuration finished. info: OmniSharp.Stdio.Host Omnisharp server running using Stdio at location '/home/fakeusername/Code/FakeProjectName' on host 3236. 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 '/home/fakeusername/Code/FakeProjectName/Assembly-CSharp.csproj'. /home/fakeusername/Code/FakeProjectName/Assembly-CSharp.csproj /home/fakeusername/.vscode/extensions/ms-dotnettools.csharp-1.23.5/.omnisharp/1.37.3/omnisharp/.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
Attempted to update project that is not loaded: /home/fakeusername/Code/FakeProjectName/Assembly-CSharp.csproj
What I've tried
Reinstalling Mono:
I repeated the installation steps for 18.04 specified here: https://www.mono-project.com/download/stable/#download-lin
I tried to a number of times, sometime uninstalling mono-devel first.
After doing so, I would test the installation with the Hello World example on this page, which always worked: https://www.mono-project.com/docs/getting-started/mono-basics/Reinstalling .NET Core SDK:
I repeated the installation steps for 18.04 specified here, following the steps under '18.04' and the corresponding 'Install the SDK': https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#1804-
I first did this without any un-installation, and it had no effect.
I then did it after removing the 'usr/share/dotnet' and 'home/fakeusername/.dotnet' directories. This did not fix the issue, and an additional problem: the console no longer recognized the dotnet command in the terminal; it showed the error:
Command 'dotnet' not found, but can be installed with:
sudo snap install dotnet-sdk
Despite this issue and the new one that arose later, I have not had any issues running the Unity game itself.