Omnisharp-vscode: Intellisense not working of c# in for unity.Firstly it showed that .net is not installed in my pc but even after installing it,intellisense is still not working

Created on 19 Apr 2020  路  4Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
VS Code version:
C# Extension version:

Steps to reproduce

Expected behavior

Actual behavior

Here is the output of omisharp log.

Starting OmniSharp server at 18/04/2020, 18:00:40
Target: c:UsersluckyDesktopUnity projectsNew Unity ProjectNew Unity Project.sln

OmniSharp server started.
Path: C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0OmniSharp.exe
PID: 12860

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 16.4 - "C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild\Current\Bin"
    MSBUILD_EXE_PATH environment variable set to 'C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild\Current\Bin\MSBuild.exe'
    Registered MSBuild instance: StandAlone 16.4 - "C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild
        MSBuildToolsPath = C:\Users\lucky\.vscode\extensions\ms-dotnettools.csharp-1.21.17\.omnisharp\1.35.0\.msbuild\Current\Bin
    Detecting Cake files in 'c:\Users\lucky\Desktop\Unity projects\New Unity Project'.
    Could not find any Cake files
    Detecting projects in 'c:\Users\lucky\Desktop\Unity projects\New Unity Project\New Unity Project.sln'.
    Queue project update for 'c:\Users\lucky\Desktop\Unity projects\New Unity Project\Assembly-CSharp.csproj'
    Detecting CSX files in 'c:\Users\lucky\Desktop\Unity projects\New Unity Project'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: c:\Users\lucky\Desktop\Unity projects\New Unity Project\Assembly-CSharp.csproj
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
    Configuration finished.
    Omnisharp server running using Stdio at location 'c:\Users\lucky\Desktop\Unity projects\New Unity Project' on host 8312.
    The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
    The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
    The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
    The referenced project 'UnityEngine.UI.csproj' does not exist.
    The referenced project 'Unity.Timeline.csproj' does not exist.
    The referenced project 'Unity.CollabProxy.Editor.csproj' does not exist.
    The referenced project 'Unity.Rider.Editor.csproj' does not exist.
    The referenced project 'Unity.TextMeshPro.csproj' does not exist.
    The referenced project 'UnityEditor.UI.csproj' does not exist.
    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
    Failed to load project file 'c:\Users\lucky\Desktop\Unity projects\New Unity Project\Assembly-CSharp.csproj'.

c:UsersluckyDesktopUnity projectsNew Unity ProjectAssembly-CSharp.csproj
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'UnityEngine.UI.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.Timeline.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.CollabProxy.Editor.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.Rider.Editor.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'Unity.TextMeshPro.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1850,5): Error: The referenced project 'UnityEditor.UI.csproj' does not exist.
C:Userslucky.vscodeextensionsms-dotnettools.csharp-1.21.17.omnisharp1.35.0.msbuildCurrentBinMicrosoft.Common.CurrentVersion.targets(1177,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: c:\Users\lucky\Desktop\Unity projects\New Unity Project\Assembly-CSharp.csproj
    Miscellaneous file: c:\Users\lucky\Desktop\Unity projects\New Unity Project\Assets\NewBehaviourScript.cs added to workspace
Resolved-By Design Triaged Unity

Most helpful comment

Since installing Visual Studio may be too much. You can get the targeting packs and a full MSBuild by installing the "Build Tools for Visual Studio" from https://visualstudio.microsoft.com/downloads/

image

All 4 comments

Hi @blackshadow369!
I was with a problem almost equals yours, I solved it changing the TargetFrameworkVersion

Go to the file Assembly-CSharp.csproj
Change "TargetFrameworkVersion" to the latest .NET Framework Dev (Targeting Pack) version (remember to download the latest version with you don't have it haha), in my case 4.7.1 became 4.8, for some reason when Unity created the project it cames with that version.

Hopes it helps you and sorry for any english grammar issues, I still learning english haha.

@SCHUGRWS is correct, through Unity may decide to change .csproj file later, and there can be multiple .csproj files that would need such babysitting (Plugins folder, Editor folder, packages etc.).

Ideally you should install targeting pack for 4.7.1. Best way to do this is: Visual Studio Installer -> <select your latest VS installation> -> Modify -> Individual Components

VS

You can try to install targetting pack manually, but I've had problems with that, from my experience installing them with "big" Visual Studio is the only sure way to make everything work.

Since installing Visual Studio may be too much. You can get the targeting packs and a full MSBuild by installing the "Build Tools for Visual Studio" from https://visualstudio.microsoft.com/downloads/

image

Going to close this out as by design. The issue is stemming from not having .NET Framework targeting packs installed, which is necessary to target .NET Framework projects.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZeldaZocker picture ZeldaZocker  路  3Comments

IdeoG picture IdeoG  路  3Comments

ghost picture ghost  路  3Comments

gregg-miskelly picture gregg-miskelly  路  3Comments

hamhub7 picture hamhub7  路  3Comments