dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.88k stars 675 forks source link

Omnisharp fails to load project, can't find the correct .NET Framework #3111

Closed DvIMPact closed 6 days ago

DvIMPact commented 5 years ago

Issue Description

Steps to Reproduce

Launch https://github.com/Autodesk-Forge/bucket.manager-csharp-sample.tool in VSCode

Expected Behavior

Should start the Bucket Manager app.

Actual Behavior

Can't load project.

Logs

OmniSharp log

Starting OmniSharp server at 12/06/2019 à 16:18:40

Target: c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.sln

OmniSharp server started. Path: C:\Users\ForgeAutodesk Dev.vscode\extensions\ms-vscode.csharp-1.19.1.omnisharp\1.32.19\OmniSharp.exe PID: 5400

    Starting OmniSharp on Windows 6.2.9200.0 (x64)
    DotNetPath set to dotnet
    Located 1 MSBuild instance(s)
        1: StandAlone 15.0 - "C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild\Current\Bin"
    MSBUILD_EXE_PATH environment variable set to 'C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild\Current\Bin\MSBuild.exe'
    Registered MSBuild instance: StandAlone 15.0 - "C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild\Current\Bin"
        CscToolExe = csc.exe
        CscToolPath = C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild\Current\Bin\Roslyn
        MSBuildExtensionsPath = C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild
        MSBuildToolsPath = C:\Users\ForgeAutodesk Dev\.vscode\extensions\ms-vscode.csharp-1.19.1\.omnisharp\1.32.19\.msbuild\Current\Bin
    Detecting Cake files in 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager'.
    Could not find any Cake files
    Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
    Detecting projects in 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.sln'.
    Queue project update for 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.csproj'
    Detecting CSX files in 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
    Loading project: c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.csproj
    Configuration finished.
    Omnisharp server running using Stdio at location 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager' on host 2044.
    The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
    Failed to load project file 'c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.csproj'.

c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.csproj C:\Users\ForgeAutodesk Dev.vscode\extensions\ms-vscode.csharp-1.19.1.omnisharp\1.32.19.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1183,5): Error: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

    Attempted to update project that is not loaded: c:\Users\ForgeAutodesk Dev\Documents\Autodesk Bucket Manager\bucket.manager\bucket.manager.csproj

Environment information

VSCode version: 1.35.0 C# Extension: 1.19.1

Dotnet Information SDK .NET Core (reflétant tous les global.json) : Version: 2.2.300 Commit: 73efd5bd87 Environnement d'exécution : OS Name: Windows OS Version: 10.0.18362 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.300\ Host (useful for support): Version: 2.2.5 Commit: 0a3c9209c0 .NET Core SDKs installed: 2.2.300 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |beautify|HookyQR|1.5.0| |Bookmarks|alefragnani|10.4.4| |camelcasenavigation|maptz|1.0.1| |change-case|mostafa|1.0.1| |color-highlight|naumovs|2.3.0| |colored-regions|mihelcic|0.0.3| |csharp|ms-vscode|1.19.1| |githistory|donjayamanne|0.4.6| |gitlens|eamodio|9.8.2| |path-intellisense|christian-kohler|1.4.2| |project-manager|alefragnani|10.5.2| |rainbow-csv|mechatroner|1.1.1| |vscode-architect|gilmarsquinelato|0.1.0| |vscode-forge-theme|forge|1.1.4| |vscode-gutter-preview|kisstkondoros|0.19.0| |vscode-nuget-package-manager|jmrog|1.1.6|;
JoeRobich commented 6 days ago

This is by design. Without the proper targeting framework MSBuild cannot reason about the projects being built. The solution would be to install the missing targeting framework.