Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core 3.0 preview 6, unreferenced System error. #1541

Closed
IdkGoodName opened this issue Jul 3, 2019 · 5 comments · Fixed by #1545
Closed

.NET Core 3.0 preview 6, unreferenced System error. #1541

IdkGoodName opened this issue Jul 3, 2019 · 5 comments · Fixed by #1545
Labels

Comments

@IdkGoodName
Copy link

I am using .NET Core 3.0 and it seems that I keep getting Predefined type 'System.Object' is not defined or imported when I define class, Predefined type 'System.{Some type name here}' is not defined or imported when using any predefined type(void, string, int, etc.) and The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) when I use using directive with System namespace in it. It seems to be only omnisharp problem, since I can compile project and run it quite easily, without errors. It's probably caused by System no longer being in project.assets.json or something else.

@filipw
Copy link
Member

filipw commented Jul 4, 2019

Can you please provide your omnisharp log and a repro project? thanks!

@IdkGoodName
Copy link
Author

About project. It happens to any .NET Core 3.0 project. Even if you create new .NET Core 3.0 prev 6 project, it says same thing.
Here's the log:

Starting OmniSharp server at 04/07/2019, 7:45:49 pm
    Target: {Path to Project}\SomethingSomething

OmniSharp server started.
    Path: {Path to user folder}\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\OmniSharp.exe
    PID: 11952

[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 3 MSBuild instance(s)
            1: Visual Studio Build Tools 2017 15.9.28307.718 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
            2: Visual Studio Community 2017 15.9.28307.718 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
            3: StandAlone 15.0 - "{Path to user folder}\.vscode\extensions\ms-vscode.csharp-1.20.0\.omnisharp\1.32.20\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Visual Studio Build Tools 2017 15.9.28307.718 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '{Path to Project}\SomethingSomething'.
[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
        No solution files found in '{Path to project}\SomethingSomething'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '{Path to Project}\SomethingSomething\SomethingSomething.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '{Path to Project}\SomethingSomething'.
[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: {Path to Project}\SomethingSomething\SomethingSomething.csproj
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '{Path to Project}\SomethingSomething' on host 2876.
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '{Path to Project}\SomethingSomething\SomethingSomething.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '{Path to Project}\SomethingSomething\SomethingSomething.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: SomethingSomething
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
        SomethingSomething: Did not find 'Microsoft.NETCore.App' in lock file.

@seesharper
Copy link
Contributor

@filipw filipw added bug and removed needs more info labels Jul 5, 2019
@filipw
Copy link
Member

filipw commented Jul 5, 2019

yep that's that. The new .NET Core 3.0 preview6+ project.assets.json files do not contain compile time dependencies for Microsoft.NETCore.App and other "framework-like" packages anymore. Instead they are being handled by targeting packs.

At the moment there is no workaround for this in OmniSharp.

@filipw
Copy link
Member

filipw commented Jul 5, 2019

actually I had a quick look at this, and the real bug is that OminSharp prefers the VS 2017 msbuild instance over the stand alone embedded one in this case.
The quickest workaround would be to install the latest Visual Studio 2019 on the same machine (or uninstall VS 2017) - that will allow OmniSharp to use its msbuild over the one from VS 2017.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants