Omnisharp-vscode: VS Code C# Not Working With ,NET Framework 4.x

Created on 5 Jan 2019  路  11Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.2.101
Commit: 236713b0b7

Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.101\

Host (useful for support):
Version: 2.2.0
Commit: 1249f08fed

.NET Core SDKs installed:
2.2.101 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

VS Code version:1.30.1
C# Extension version:1.17.1

############# OmiCharp Output
Starting OmniSharp server at 1/5/2019, 10:45:03 AM
    Target: c:\Users\Public\Documents\Unity Projects\New\New.sln

OmniSharp server started.
    Path: C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\OmniSharp.exe
    PID: 11972

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to 'C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
            CscToolExe = csc.exe
            CscToolPath = C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin\Roslyn
            MSBuildExtensionsPath = C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild
            MSBuildToolsPath = C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\Users\Public\Documents\Unity Projects\New'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in 'c:\Users\Public\Documents\Unity Projects\New\New.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for 'c:\Users\Public\Documents\Unity Projects\New\Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in 'c:\Users\Public\Documents\Unity Projects\New'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\Public\Documents\Unity Projects\New\Assembly-CSharp.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location 'c:\Users\Public\Documents\Unity Projects\New' on host 1144.
[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for framework ".NETFramework,Version=v4.5" 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.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Users\Public\Documents\Unity Projects\New\Assembly-CSharp.csproj'.
c:\Users\Public\Documents\Unity Projects\New\Assembly-CSharp.csproj
C:\Users\Sahand\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1126,5): Error: The reference assemblies for framework ".NETFramework,Version=v4.5" 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.

[fail]: OmniSharp.MSBuild.ProjectManager
        Attemped to update project that is not loaded: c:\Users\Public\Documents\Unity Projects\New\Assembly-CSharp.csproj

Most helpful comment

i had solved it
1.visit https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
2.download .NET Framework4.x Developer Pack and install

All 11 comments

so it just like me
anybody know how to fix it?

I had a similar problem, and I fixed it by removing all pre-2017 VS versions from my PC and installing most up-to-date VS 2017 version.

Yes I'm talking about "big" VS, not VSCode.

If you have problems with this still, inside VS Installer app you can try "Modify Installation -> Individual Components -> Add missing pack"
vsinstaller

witch one of this components do i need?

In the error log there is "The reference assemblies for framework ".NETFramework,Version=v4.5" were not found", so just try to get all 4.5 packs?

Do you have multiple installations of VS on your machine? Maku sure all are updated. I saw ome guy have issues because it had random VS2013 installation lying somewhere, and I had issues because I had both VS2017 pro and community installed, a d community was not up to date

@AminAhmady Your log indicates that no VS was available on your machine. Do you have any VS installations?

i had the same issue in the past few days.
set unity3d 'scripting runtime version = .net 4.x equivalent', and had set the .net 4.7.2(win10), but in the end that open code by vscode to create the 'Assembly-CSharp.csproj' , then 'TargetFrameworkVersion = v4.5'.
so 'C# for Visual Studio Code (powered by OmniSharp)' just no work...
anyone can help me to understand where is wrong?

@ComeHereRobot Can you share your omnisharp log?

the same issue, the same log,unity3d with .net4.6

i had solved it
1.visit https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
2.download .NET Framework4.x Developer Pack and install

Is there a solution for Linux in this case? We only have .NET Core

The solution is:

If you are using C# Extension 1.23.1 please make sure that global Mono is correctly used - see https://github.com/OmniSharp/omnisharp-vscode/issues/4007#issuecomment-677405332

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kiminuo picture kiminuo  路  3Comments

jrmcdona picture jrmcdona  路  3Comments

visten picture visten  路  4Comments

mshinnie picture mshinnie  路  3Comments

mattwoberts picture mattwoberts  路  3Comments