首页 > 解决方案 > “无法创建目录“/Debug/”。对路径“/Debug/”的访问被拒绝。” 在 Ubuntu 上使用 Visual Studio Code 打开 Unity3D 项目时

问题描述

我从 Windows 10 迁移到 Ubuntu 19.04,并且我有一些过去的 Unity 项目要处理。我从 Microsoft 站点安装了 VS Code、C# 和 Unity 调试器扩展、.NET SDK 2.2、最新的 Mono (6.0.0.319) 和 Unity 2019.2.0f1。当我尝试打开项目时,OmniSharp 日志显示: [warn]: OmniSharp.MSBuild.ProjectLoader Unable to create directory "/Debug/". Access to the path "/Debug/" is denied. 以及由此导致的其他一些错误,导致 .csproj 文件无法加载。

首先,我搜索了这个问题,但发现只有一个合适的线程说我需要重新安装msbuild。但是msbuildAPT 上没有任何包,所以我去了 MSBuild 的 GitHub,它说msbuild没有与 .NET SDK 分开发货。然后我卸载了 Mono,但是 VSC 说我没有“.NET Framework 4.7.1”,所以我再次安装了 Mono。后来我重新安装了 .NET SDK 和 VS Code,但问题似乎仍然存在。

dotnet --info如果它可以帮助解决,这是我的:

Пакет SDK для .NET Core (отражающий любой global.json):
 Version:   2.2.401
 Commit:    729b316c13

Среда выполнения:
 OS Name:     ubuntu
 OS Version:  19.04
 OS Platform: Linux
 RID:         ubuntu.19.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.401/

Host (useful for support):
  Version: 2.2.6
  Commit:  7dac9b1b51

.NET Core SDKs installed:
  2.2.401 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

OmniSharp 日志本身(从警告开始):

[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/alt3r3d/UnityProjects/some random test' on host 14700.
[warn]: OmniSharp.MSBuild.ProjectLoader
        Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
[warn]: OmniSharp.MSBuild.ProjectLoader
        Could not write state file "/Debug/Assembly-CSharp.csprojAssemblyReference.cache". Could not find a part of the path "/Debug/Assembly-CSharp.csprojAssemblyReference.cache".
[fail]: OmniSharp.MSBuild.ProjectLoader
        Could not write lines to file "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache".
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/alt3r3d/UnityProjects/some random test/Assembly-CSharp.csproj'.
/home/alt3r3d/UnityProjects/some random test/Assembly-CSharp.csproj
/home/alt3r3d/.vscode/extensions/ms-vscode.csharp-1.21.0/.omnisharp/1.34.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1144,5): Error: Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
/home/alt3r3d/.vscode/extensions/ms-vscode.csharp-1.21.0/.omnisharp/1.34.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(2130,5): Error: Could not write state file "/Debug/Assembly-CSharp.csprojAssemblyReference.cache". Could not find a part of the path "/Debug/Assembly-CSharp.csprojAssemblyReference.cache".
/home/alt3r3d/.vscode/extensions/ms-vscode.csharp-1.21.0/.omnisharp/1.34.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(3450,5): Error: Could not write lines to file "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache".

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/alt3r3d/UnityProjects/some random test/Assembly-CSharp.csproj

标签: c#.netunity3dvisual-studio-codemsbuild

解决方案


推荐阅读