所以,我对编码有点陌生。我正在做一个联合游戏,我刚开始编写脚本。不幸的是,VScode没有和我一起工作。我已经在VScode和.NET版本中安装了最新的.NET扩展6.0.401。
每当我启动IDE时,都会收到一条错误消息
Some projects have trouble loading. Please review the output for more details.
Source: C# (Extension)
当我检查输出时,它是这样写的:
Target: c:\Users\Drews\My project
OmniSharp server started with .NET 6.0.401
.
Path: c:\Users\Drews\.vscode\extensions\ms-dotnettools.csharp-1.25.0-win32-
x64\.omnisharp\1.39.0-net6.0\OmniSharp.dll
PID: 6088
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 10.0.22000.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: .NET Core SDK 6.0.401 17.3.1 - "C:\Program Files\dotnet\sdk\6.0.401\"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: .NET Core SDK 6.0.401 17.3.1 - "C:\Program
Files\dotnet\sdk\6.0.401\"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider:
OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'c:\Users\Drews\My project\My project.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\Drews\My project\UnityEngine.UI.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\Drews\My project\Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\Drews\My project\UnityEditor.UI.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\Drews\My project'.
[info]: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\Drews\My project' on host
788.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\Drews\My project\UnityEngine.UI.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 'c:\Users\Drews\My project\UnityEngine.UI.csproj'.
c:\Users\Drews\My project\UnityEngine.UI.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\Drews\My project\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 'c:\Users\Drews\My project\Assembly-CSharp.csproj'.
c:\Users\Drews\My project\Assembly-CSharp.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\Drews\My project\UnityEditor.UI.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 'c:\Users\Drews\My project\UnityEditor.UI.csproj'.
c:\Users\Drews\My project\UnityEditor.UI.csproj
C:\Program Files\dotnet\sdk\6.0.401\Microsoft.Common.CurrentVersion.targets(1220,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: c:\Users\Drews\My
project\UnityEngine.UI.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Users\Drews\My project\Assembly-
CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Users\Drews\My
project\UnityEditor.UI.csproj
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
Inlay hints requested for document not in workspace Location { FileName =
c:\Users\Drews\My project\Assets\Scripts\Player.cs, Range = Range { Start = Point { Line
= 0, Column = 0 }, End = Point { Line = 23, Column = 0 } } }
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
Inlay hints requested for document not in workspace Location { FileName =
c:\Users\Drews\My project\Assets\Scripts\Player.cs, Range = Range { Start = Point { Line
=
0, Column = 0 }, End = Point { Line = 23, Column = 0 } } }
另外,intellisense无法工作,所以我必须手动输入内容。我几乎没有理智,也没有足够聪明去尝试去修复它。如果需要更多的信息,我会提供。
发布于 2022-10-04 03:38:02
我不知道为什么这个问题还没有得到回答,但是为了使它尽可能简单,不要使用最新版本的.net,但是它仍然指向最新版本的链接,但是它写在日志中,它正在寻找4.7.1版本,从这里下载它,我的兄弟(下载devPack,然后重新启动您的pc) https://dotnet.microsoft.com/en-us/download/dotnet-framework/net471
发布于 2022-10-04 04:01:58
您需要Dot 开发人员包4.7.1版(而不是运行时版本)才能使VScode正确地与团结一起工作。
在安装开发人员包时,请确保关闭Vscode和Unity。
https://stackoverflow.com/questions/73942733
复制相似问题