Visual Studio Code Intellisense doesn't work with Unity 2018

That’s worked!

I’m going to hop of this thread to voice a similar issue I’ve been having, but the issue isn’t due to the fact I don’t have the newest version, it’s that Unity is defaulting the value to 4.5, even when I try change it to 4.7.2. I’ve been trying to get a .net 4.5 SDK version, I’ve only found 4.5.2 so far, and that isn’t fixing the lack of Intellisense. It’s very frustrating, if anyone can suggest a fix I’d be very grateful

2 Likes

The lastest alpha somehow default to v4.7.2 and I installed Visual Studio (not code), updated .NET Core to latest, updated Mono to latest, and it still fails to start omnisharp in VSCode. I ended up search and replace with v4.7.1 and it works, but if Unity regenerate the project file I have to do it again. Also note that this is on macOS, so the obvious path of installing the framework or targeting pack does not work (it is .exe)

1 Like

On my laptop I had to install the latest .NET, restart and let Visual Studio Community 2017 create the sln and csproj files, then open VSCode. That solved the problem. HOWEVER, on my friend’s laptop, with basically the exact same setup, Unity and Visual Studio would not update in the *.csproj files (3 of them) from v4.5 to v4.7.1. So, we went in there and did it manually and VOILA it worked.

For those who haven’t solved this problem yet

  1. Open Assembly-CSharp.csproj file,it’s in root of your project
  2. You only have to change this v4.6.1
  3. Just replace with whatever version of .NET framework sdk installed.

You should have both .NET framework and targeting sdk installed for a particular version,dont’ use version less than 3.5
cause it’s now obsolete for unity 2018.

This is a temporary solution cause targetFrameworkVersion always changes to unity default when you close the editor

1 Like

I’m working on Mac and this just started happening to me after I changed my Scripting Runtime Version… I moved my project from .Net35 Equivalient (Deprecated) to .Net4x, and I lose my Omnisharp. A bit annoying… the loss of this functionality is big enough to make me switch it back.

Is there a better solution for mac users?

latest unity on ubuntu

could not get unity work at all
installed all dependencies from thread
worked

could not find installable 4.7.1 like vscode asks for
intalled mono
works

thanks

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
      <Content Include="Name.csv">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
      <Content Include="Syllable.csv">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
      <Content Include="Title.csv">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
    </ItemGroup>
</Project>

the new dotnet ‘1 line’ project files are nice and easy to use but we stuck with 600 lines of should be git-ignored generated project files

First result for “.NET 4.7.1” gave me the download link.

https://www.microsoft.com/en-us/download/details.aspx?id=56116

I remember this happened to me last year. This was a headache and I couldn’t find any solution.
Now i’m using the free version of VS 2017 with Brackeys theme.
Good luck guys.

On Linux that does not not seem to have a Linux download like netcore 2.2 etc I guess mono is required on Linux unless I switch to illcp or whatever

After some research, I found that upgrading mono is all that was needed to use the latest version of .net.

Welp, this issue has returned for me at some point. I’m now using 2018.3.7f1.

I have .NET Framework 4.7.2 installed, and “TargetFrameworkVersion” is targeting 4.7.2.

I’ve already applied the hacky solution to rename the folder, so not sure what else to try.

Issue tracker states that the issue is fixed in 2018.3 but not which version.

I recall fixing intellisense issues by deleting the “.vscode” directory inside the project I was working on.

3 Likes

Updating Mono fixed it for me.

I confirm, works for me on Win 10 latest updates (so .net SDK latest ver. is included), with unity 2018.3.11f1 with VS code 1.33.1

1 Like

I ran into this issue again, running 2019.1.XX with Visual Studio Code on Windows 10.

What fixed it for me was using the link provided by @hychul (which redirects to .NET SDKs for Visual Studio for me) and installing the 4.5, 4.6, 4.7, 4.7.1, 4.7.2, and 4.8 SDKs under “.NET Framework”, ensuring to download the items under “Developer Pack”, NOT under “Runtime”. Other links to .NET 4.7.1 seemed to have installed the Runtime pack, which definitely will not fix the issue.

Was it overkill to install all 6 of the Developer Packs? Most likely… but that’s what worked for me (though I didn’t work backwards, I just did all 6 before testing again, so try working backwards down the list until it fixes it so you don’t waste your time).

And don’t forget to set Visual Studio Code as your External Editor in the Unity Preferences instead of “… by extension”.

I recently did a fresh install of Windows 10 (upgraded from 7) and got it to work just using .NET 4.7.1, although not at first.

This turned out to be the kicker for me. If you don’t set that, Unity will default to “open by file extension”, which just opens your scripts as regular individual script files when you double-click them in the Project tab, instead of opening the project. Once I changed the setting in Preferences > External Tools, it worked perfectly.

For Ubuntu 18.04, in short: install mono from their official repos in their website (Download - Stable | Mono), not from Ubuntu repos!

And that’s it! I might just have saved you from several hours of vain research work and frustration. Here’s how mine went:

  • search for error without actually reading it. Landed here. Read CrowbarSka’s comment: “The solution was simply to a) read the error and b) follow its instructions XD”. Laugh. Find out it isn’t that straightforward for Linux. Cry.
  • I need a higher version of mono-reference-assemblies. I’ll update everything. Failed, highest is still 4.0.
  • I found mono reference assemblies github! And they have v4.7.2! I’ll download zip and install… Fail, building/installation instructions look more like library own developers instructions or package maintainer instructions. Look how other mono-reference-assemblies Ubuntu packages look. Wait… this is a bunch of .dll and I got them in this zip, so maybe I just have to install to the right place… hold it, hold it, hold it now… we’re going overboard here and gonna leave things in an unusable state and we’re working too much.
  • I read someone, somewhere, said those reference assemblies have to be same version than mono compiler… So maybe I should just try to update mono as a whole, are there backports? no… but hmm, I already checked latest unstable Ubuntu versions only have up to mono-reference-assemblies-4.0… so… Oh, I know! I’ll check the official website and see.
  • Ok, I added the official repo and tried to update but it’s saying it will install 4.0… hmmm… Oh this guy on this bug tracker is saying he’s having the same problem but when he actually went ahead and updated he got the 5.x version! Fair enough! I’ll give a try! Yeah it installed 5.x!
  • Crossed fingers, let’s give it a try by opening a project on the latest Unity beta. Woah! It works! What about an older project on 2017.3.x? It still works! Grrrrreeaaat!

Which is why I hate having to put much time into setting up IDEs and stuff. It’s always a freaking nightmare and specially a waste of time. Whenever I have to try a new engine, library, upgrade or whatnot I start shaking. Coding is not a problem but that thing really sucks. I was so happy to see that 2019 resolved the issue with sound delay on many not-top-brand phones including Xiaomi, and then when I resume working on vscode wah wah wah wah (

)… that dreaded error (which I had seen before long ago BTW) and no intellisense… FML.

In my w10 i’m just install this: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56119, restart the vscode and done: everything work properly.

Same here with Unity 2019.2.8 on win10. Don’t bother with .NET 4.8, for me this was all I needed.