c# - Ubuntu 19.10 上的 Unity3D,带有 vscode 和 C# 扩展 : get an error and the autocomplete doesn't working

标签 c# .net unity3d ubuntu visual-studio-code

我是一名网络开发人员 (symfony <3 ;) C# 和 microsoft 技术对我来说是新的! )并且在covid遏制期间,我想用游戏引擎统一创建一个简单的游戏

Ubuntu 19.10 上,我下载了 unity Hub v2.3.0 ( https://unity3d.com/get-unity/download )

从统一集线器,我安装了 unity3D v2019.3.7f1 (最新稳定版)和一些选项( Linux & WebGL & windows build support )

enter image description here

我创建了一个简单的 2D 游戏

enter image description here

一切都像魅力一样,我可以在 unity3D 控制台中打开我的项目并运行我的新游戏而不会出现任何错误

在 Unity 中,当我创建一个 c# 脚本时,可以通过我的(非常简单的)文本编辑器 gedit 打开该文件。现在我想安装跨操作系统 IDE 可视化代码,谢谢,当我编辑统一脚本时,我会得到一些有用的扩展和自动完成代码。

所以,我通过 apt install 安装了 vscode(我遵循了这个官方指南:https://code.visualstudio.com/docs/setup/linux)

我的 vscode 版本是:

enter image description here

经过一些网络搜索,我知道我必须安装 .NET 框架(也许我错了?)

enter image description here

我的 dotnet 版本(来自终端:dotnet --version)是 3.1.201

接下来我配置了统一参数以更改默认文本编辑器:

enter image description here

  • 外部脚本编辑器:代码
  • code指路径/usr/bin/code,vscode的可执行文件
  • 外部脚本编辑器参数:"$(ProjectPath)"-g "$(File)":$(Line):$(Column)

    默认值为
  • ,我没有更改任何内容

  • 我从统一创建了一个简单的 c# 脚本,我打开了文件并自动打开了 vscode(是的!)。从 vscode 我添加了两个公共(public)变量(bool 'a' 和 Rigidbody2D 'b')

    enter image description here

    我保存了我的脚本并转到统一应用程序,变量 a 和 b 在界面上可见:

    enter image description here

    所有作品!
    但是现在,我想要来自 vscode 的自动完成代码。所以,我安装了 vscode c# 扩展。但是安装完成后,会出现此消息:

    enter image description here

    整个日志是:
    Starting OmniSharp server at 4/2/2020, 8:10:51 PM
        Target: /home/okli/UnityProjects/SampleGame/SampleGame.sln
    
    OmniSharp server started.
        Path: /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/run
        PID: 15372
    
    [info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 19.10 (x64)
    [info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.4 - "/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin"
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.4 - "/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild
    [info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/okli/UnityProjects/SampleGame'.
    [info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
    [info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/okli/UnityProjects/SampleGame/SampleGame.sln'.
    [info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/okli/UnityProjects/SampleGame/Assembly-CSharp.csproj'
    [info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/okli/UnityProjects/SampleGame'.
    [info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
    [info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
    [info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/okli/UnityProjects/SampleGame' on host 14406.
    [info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/okli/UnityProjects/SampleGame/Assembly-CSharp.csproj
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Animation.Runtime.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.PixelPerfect.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.SpriteShape.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Path.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'UnityEngine.UI.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Timeline.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Animation.Triangle.Runtime.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'PsdPlugin.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.CollabProxy.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Rider.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Mathematics.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Psdimporter.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.InternalAPIEngineBridge.001.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Sprite.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Common.Runtime.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Tilemap.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.SpriteShape.Runtime.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.PixelPerfect.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Animation.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.Mathematics.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.TextMeshPro.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.2D.Common.Editor.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'Unity.InternalAPIEditorBridge.001.csproj' does not exist.
    [warn]: OmniSharp.MSBuild.ProjectLoader
        The referenced project 'UnityEditor.UI.csproj' does not exist.
    [fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    [warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/okli/UnityProjects/SampleGame/Assembly-CSharp.csproj'.
    /home/okli/UnityProjects/SampleGame/Assembly-CSharp.csproj
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Animation.Runtime.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.PixelPerfect.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.SpriteShape.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Path.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'UnityEngine.UI.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.Timeline.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Animation.Triangle.Runtime.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'PsdPlugin.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.CollabProxy.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.Rider.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.Mathematics.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Psdimporter.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.InternalAPIEngineBridge.001.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Sprite.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Common.Runtime.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Tilemap.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.SpriteShape.Runtime.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.PixelPerfect.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Animation.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.Mathematics.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.TextMeshPro.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.2D.Common.Editor.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'Unity.InternalAPIEditorBridge.001.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1870,5): Error: The referenced project 'UnityEditor.UI.csproj' does not exist.
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1193,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    
    [fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/okli/UnityProjects/SampleGame/Assembly-CSharp.csproj
    

    有些东西似乎不起作用...但是,我可以修改并保存我的 c# 脚本(例如添加一个新的公共(public) var,该变量是在统一界面中添加的),但是当我键入 public Rigidbod 和按 ctrl + space 没有显示任何自动完成帮助。

    我不熟悉 C#/vscode/microsoft 技术,我更喜欢在这里问如果我忘记了什么和/或在尝试(坏)解决方案之前做错了什么

    感谢您的帮助!

    编辑:我刚刚在 unity3D 界面上通知了这个错误

    enter image description here

    我会搜索一下这个错误...

    在 0xBFE1A8 之后编辑 答案:
  • 我创建了一个新项目'plop'
  • 在 UnityEditor 中,我将 Visual Studio 代码编辑器版本更改为 1.1.3,然后单击“更新 1.1.3”按钮

  • 错误并没有消失,所以我继续:
  • 我在“Packages/manifest.json”中将“com.unity.ide.vscode”修改为1.1.3
  • 在 UnityEditor 中,选中“生成所有 .csproj 文件”复选框
  • 然后,我单击菜单 Assets 中的“全部重新导入”

  • 毕竟,vsecode 中的自动完成代码不起作用,但错误日志更小:
    Starting OmniSharp server at 4/5/2020, 6:56:52 PM
        Target: /home/okli/UnityProjects/plop/plop.sln
    
    OmniSharp server started.
        Path: /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/run
        PID: 30149
    
    [info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 19.10 (x64)
    [info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.4 - "/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin"
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
    [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.4 - "/home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild
    [info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/okli/UnityProjects/plop'.
    [info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
    [info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/okli/UnityProjects/plop/plop.sln'.
    [info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/okli/UnityProjects/plop/Assembly-CSharp.csproj'
    [info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/okli/UnityProjects/plop'.
    [info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    [info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
    [info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
    [info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/okli/UnityProjects/plop' on host 30017.
    [info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/okli/UnityProjects/plop/Assembly-CSharp.csproj
    [fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    [warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/okli/UnityProjects/plop/Assembly-CSharp.csproj'.
    /home/okli/UnityProjects/plop/Assembly-CSharp.csproj
    /home/okli/.vscode/extensions/ms-dotnettools.csharp-1.21.16/.omnisharp/1.34.15/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1193,5): Error: The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
    
    [fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/okli/UnityProjects/plop/Assembly-CSharp.csproj
    

    最佳答案

    此警告是已知的 Visual Studio Code Editor 1.1.4 bug .
    根据this information ,它是 全能 导致错误的扩展:

    This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

    Happy Coding!



    对我来说,降级到版本 1.1.3 的包解决了问题。

    Unity编辑器前往: [窗口]->[包管理器]->[Visual Studio代码编辑器]->:选择1.1.3版本,点击“更新1.1.3”按钮。

    enter image description here

    如果在那之后错误没有消失:
  • 1) 在“Packages/manifest.json”中更改了“com.unity.ide.vscode”:“1.1.3”
  • 2) 在 Unity编辑器前往: [编辑]->[首选项]->[外部工具]:将“生成所有 .csproj 文件”复选框设置为 true。
  • 3) 在 Unity编辑器转到:[ Assets ]->[全部重新导入]

  • 有人说,如果降级到 1.1.3 在升级到 之后1.2.0 错误应该被修复,但我还没有尝试过。

    关于c# - Ubuntu 19.10 上的 Unity3D,带有 vscode 和 C# 扩展 : get an error and the autocomplete doesn't working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60998457/

    相关文章:

    c# - 无法连接到远程服务器

    c# - 堆栈的替代方案

    c# - 如何将静态属性设置为仅针对特定元素的值?

    c# - 团结/骑士: order of multiplication operations is inefficient?

    3d - 将 .ply 文件导入到 unity 3D

    unity3d - 当 Unity 中的 timeScale 为 0 时,如何使 TrailRenderer 工作?

    c# - 使用 AspNet 从 Azure Blob 存储下载并重命名文件

    c# - 递归正则表达式 : Unrecognized grouping construct

    c# - 由于奇怪的错误,无法在 Visual Studio 2008 C# Windows 窗体中看到设计器 View

    .net - 使用托管数组和 std :array at same time 不兼容