Omnisharp-vscode: Failed to load project with Red Hat .NET Core SDK 2.0 (rh-dotnetcore20)

Created on 31 Aug 2017  路  12Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

$ dotnet --info
.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     rhel
 OS Version:  7
 OS Platform: Linux
 RID:         rhel.7-x64
 Base Path:   /opt/rh/rh-dotnet20/root/usr/lib64/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : N/A

VS Code version: 1.15.1
C# Extension version: 1.12.1

Steps to reproduce

  1. Install Red Hat .NET Core SDK 2.0 on RHEL 7.3 Server
    https://access.redhat.com/documentation/en-us/net_core/2.0/html/getting_started_guide/gs_install_dotnet#install_dotnet20

  2. Create a Project.
    $ dotnet new console

  3. Open with Visual Studio Code
    $ code .

Expected behavior

Load C# project without error.

Actual behavior

Got the error.

Starting OmniSharp server at 2017/8/31 21:57:50
    Target: /home/tatanaka/omnisharpdebug

OmniSharp server started wth Mono
    Path: /home/tatanaka/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/run
    PID: 20538

OmniSharp: -s /home/tatanaka/omnisharpdebug --hostPID 20349 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
锘匡豢{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/home/tatanaka/omnisharpdebug' on host 20349."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /home/tatanaka/omnisharpdebug
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Omnisharp will use local MSBuild.
    MSBUILD_EXE_PATH: /home/tatanaka/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/MSBuild.dll
    MSBuildExtensionsPath: /home/tatanaka/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild
    RoslynTargetsPath: /home/tatanaka/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/Roslyn
    CscToolPath: /home/tatanaka/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/omnisharp/msbuild/Roslyn

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        No solution files found in '/home/tatanaka/omnisharpdebug'
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /home/tatanaka/omnisharpdebug/omnisharpdebug.csproj
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        The "Microsoft.NET.Build.Tasks.ReportAssetsLogMessages" task could not be loaded from the assembly /opt/rh/rh-dotnet20/root/usr/lib64/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/../tools/net46/Microsoft.NET.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/home/tatanaka/omnisharpdebug/omnisharpdebug.csproj'.
/home/tatanaka/omnisharpdebug/omnisharpdebug.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/tatanaka/omnisharpdebug'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Services.WorkspaceHelper
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

I'm afraid this issue depends on Red Hat provided .NET Core. Could you help finding the root cause? I can ask Red Hat engineers to fix SDK if needed.
The Red Hat .NET Core build is based on https://github.com/dotnet/source-build/. Red Hat .NET Core doesn't have the 'sdk/2.0.0/Sdks/Microsoft.NET.Sdk/tools/net46/Microsoft.NET.Build.Tasks.dll'. Instead, there is such a dll at 'netcoreapp1.0' (instead of 'net46').

Resolved-External Triaged

All 12 comments

Thanks for reporting this issue! I've heard about it, but hadn't received any feedback on this yet.

If I recall correctly, the issue here is that the .NET Core SDK source build does not include net46 binaries. @nguerrera, do you know how to route this?

To be clear: this issue is caused by the fact that OmniSharp itself runs as a net46 app on Mono. When it uses MSBuild inproc the .NET Core SDK tries to load the MSBuild tasks for net46 because that's the current runtime.

Thanks @nguerrera! I'll leave this open here to track the customer impact of the problem.

This also happens for me as a Fedora user (no big surprise though).

Using dotnet packages from the official SIG @ https://copr.fedorainfracloud.org/coprs/g/dotnet-sig/dotnet/

~I get the same error on Windows 7 when I open a C# project from Git Bash with code .. It works correctly if I open VS Code and navigate to the project directory.~

Sorry, the error I have is actually different.

@inosik: In that case, could you file a separate issue?

Any update on this? Also having this issue (Fedora).

@martinmine: The problem is actually within the .NET Core SDK. We're tracking that with https://github.com/dotnet/source-build/issues/125.

To provide a little bit of an update, since there wasn't one, the issue was hacked up in our packages to somehow work, but the results are not guaranteed ;P

Closing this out as the source build work is completed and many other things haven stabilized since this was reported.

Was this page helpful?
0 / 5 - 0 ratings