skip to Main Content

I am running Ubuntu 20.04, vscode, and .net 6. When I try to load my app in vs studio, I get this error:

[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/one/github/ion/Migration/Tests/Migrator.Tests/Migrator.Tests.csproj'.
/home/one/github/ion/GCPMigration/Tests/AwsMigrator.Tests/Migrator.Tests.csproj
/usr/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): Error: The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.

and in my screen I am not given the option to ‘Generate C# assets for Build and Debug’:

enter image description here

I do have .net6 successfully installed:

% dotnet --list-sdks
3.1.424 [/usr/share/dotnet/sdk]
6.0.405 [/usr/share/dotnet/sdk]

I created a global.json file in the root of the project:

 {
    "sdk": {
      "version": "6.0.405"
    }
  }

And then I restarted VS code but still no success. How can I make vs code find .net 6?

UPDATE: Here is more output:

% code --list-extensions --show-versions

[email protected]
[email protected]
% dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.405
 Commit:    27ab36058b

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.405/

global.json file:
  /home/one/github/ion/Migration/Migrator/global.json

Host:
  Version:      6.0.13
  Architecture: x64
  Commit:       1af80ba017

.NET SDKs installed:
  3.1.424 [/usr/share/dotnet/sdk]
  6.0.405 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.30 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Update 2:

% code -s
[165406:0130/112324.020541:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[165406:0130/112324.020669:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[165406:0130/112324.024558:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[165438:0130/112324.116599:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[165474:0130/112324.239777:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[165543:0130/112324.277406:WARNING:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
[165543:0130/112324.283025:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
Version:          Code 1.73.0 (8fa188b2b301d36553cbc9ce1b0a146ccb93351f, 2022-11-01T15:44:09.336Z)
OS Version:       Linux x64 5.4.0-137-generic
CPUs:             AMD Ryzen 5 2600 Six-Core Processor (11 x 3393)
Memory (System):  38.26GB (36.34GB free)
Load (avg):       1, 0, 0
VM:               0%
Screen Reader:    no
Process Argv:     . --crash-reporter-id 12ef4ab5-5c49-4439-9359-bc412e87bbfd
GPU Status:       2d_canvas:                              unavailable_software
                  canvas_oop_rasterization:               disabled_off
                  direct_rendering_display_compositor:    disabled_off_ok
                  gpu_compositing:                        disabled_software
                  multiple_raster_threads:                enabled_on
                  opengl:                                 disabled_off
                  rasterization:                          disabled_software
                  raw_draw:                               disabled_off_ok
                  skia_renderer:                          enabled_on
                  video_decode:                           disabled_software
                  video_encode:                           disabled_software
                  vulkan:                                 disabled_off
                  webgl:                                  unavailable_software
                  webgl2:                                 unavailable_software
                  webgpu:                                 disabled_off

CPU %   Mem MB     PID  Process
    0      118  165016  code main
    0       39  165021     zygote
    3      118  165088       gpu-process
    0       39  165022     zygote
    0        0  165024       zygote
    0       39  165079     utility-network-service
    0      313  165116     window (global.json - Migration - Visual Studio Code)
    0      157  165137     shared-process
    0       39  165168       ptyHost
    0        0  165365         /usr/bin/zsh -i
    0        0  165389           sh /usr/bin/code -s
    0       39  165394             /usr/share/code/bin/../code /usr/share/code/bin/../resources/app/out/cli.js --ms-enable-electron-run-as-node -s
    0      118  165406               /usr/share/code/code -s --enable-crashpad
    0       39  165409                 zygote
    0       39  165474                   gpu-process
    0       39  165410                 zygote
    0        0  165412                   zygote
    0       39  165472                 utility-network-service
    0        0  165486                 /bin/sh -c /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0        0  165487                   /usr/bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0       39  165209       fileWatcher
    0      118  165138     extensionHost
    0       39  165208       /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=165138
    0      157  165317       mono --assembly-loader=strict /home/one/.vscode/extensions/ms-dotnettools.csharp-1.25.4-linux-x64/.omnisharp/1.39.4/omnisharp/OmniSharp.exe -z -s /home/one/github/ion/Migration/Migrator.sln --hostPID 165138 DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information --plugin /home/one/.vscode/extensions/ms-dotnettools.csharp-1.25.4-linux-x64/.razor/OmniSharpPlugin/Microsoft.AspNetCore.Razor.OmniSharpPlugin.dll FileOptions:SystemExcludeSearchPatterns:0=**/.git FileOptions:SystemExcludeSearchPatterns:1=**/.svn FileOptions:SystemExcludeSearchPatterns:2=**/.hg FileOptions:SystemExcludeSearchPatterns:3=**/CVS FileOptions:SystemExcludeSearchPatterns:4=**/.DS_Store FileOptions:SystemExcludeSearchPatterns:5=**/Thumbs.db FormattingOptions:EnableEditorConfigSupport=true formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4

Workspace Stats: 
|  Window (global.json - Migration - Visual Studio Code)
|    Folder (Migration): 82 files
|      File types: cs(32) json(9) md(9) csproj(2) bat(2) yml(2)
|                  gitattributes(1) gitignore(1) sln(1) cake(1)
|      Conf files: csproj(2) sln(1) dockerfile(1)

2

Answers


  1. Please check the version of CSharp extension (which uses OmniSharp) installed in your VS Code.

    code --list-extensions --show-versions
    

    And maybe more information can be obtained by running VS Code and then in parallel running the following command:

    code -s | grep dotnet
    

    Also what is returned by

    dotnet --info
    

    Update:

    Setting omnisharp.useModernNet option to true resolved the issue.

    Login or Signup to reply.
  2. My advice to you is to use Rider instead of VSCode especially in ubuntu.
    you can download it from

    https://www.jetbrains.com/help/rider/Installation_guide.html

    I got this error and i spent lots of time to fix it but never find the solution.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search