【问题标题】:Omnisharp on linux apperently starts but fails to load project and outputs errors on visual studio codelinux 上的 Omnisharp 明显启动但无法加载项目并在 Visual Studio 代码上输出错误
【发布时间】:2021-02-23 03:53:51
【问题描述】:

根据输出信息,omnisharp 启动但无法在 ubuntu 上加载项目。这是错误信息

[fail]: OmniSharp.MSBuild.ProjectLoader
        The "CreateAppHost" task failed unexpectedly.
System.UnauthorizedAccessException: Access to the path is denied. ---> System.IO.IOException: Operacija ni dovoljena (Operation not allowed i think for some reason this part shows in my chosen OS langauge)
   --- End of inner exception stack trace ---
  at Interop.ThrowExceptionForIoErrno (Interop+ErrorInfo errorInfo, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00014] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Interop.CheckIo (System.Int64 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x0000a] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Interop.CheckIo (System.Int32 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x0005c] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00062] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.NET.HostModel.AppHost.BinaryUtils.CopyFile (System.String sourcePath, System.String destinationPath) [0x00020] in <ed3b6b71decf41cb8876c183ba6fdd7e>:0 
  at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom) [0x00043] in <ed3b6b71decf41cb8876c183ba6fdd7e>:0 
  at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore () [0x0009f] in <66b08175c8bd43eda1fda46fdebf1641>:0 
  at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x0002e] in <66b08175c8bd43eda1fda46fdebf1641>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <f7274894ce154696afba1f0ffcd06434>:0 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002fc] in <f7274894ce154696afba1f0ffcd06434>:0 
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 

在此之前它还会输出此警告消息:

[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'path to projectfile'.
path to projectfile
/usr/share/dotnet/sdk/5.0.102/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(460,5): Error: The "CreateAppHost" task failed unexpectedly.
System.UnauthorizedAccessException: Access to the path is denied. ---> System.IO.IOException: Operacija ni dovoljena
   --- End of inner exception stack trace ---
  at Interop.ThrowExceptionForIoErrno (Interop+ErrorInfo errorInfo, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00014] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Interop.CheckIo (System.Int64 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x0000a] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Interop.CheckIo (System.Int32 result, System.String path, System.Boolean isDirectory, System.Func`2[T,TResult] errorRewriter) [0x00000] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x0005c] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00062] in <9f0df102fe6e4cfea29d2e46f585d8a5>:0 
  at Microsoft.NET.HostModel.AppHost.BinaryUtils.CopyFile (System.String sourcePath, System.String destinationPath) [0x00020] in <ed3b6b71decf41cb8876c183ba6fdd7e>:0 
  at Microsoft.NET.HostModel.AppHost.HostWriter.CreateAppHost (System.String appHostSourceFilePath, System.String appHostDestinationFilePath, System.String appBinaryFilePath, System.Boolean windowsGraphicalUserInterface, System.String assemblyToCopyResorcesFrom) [0x00043] in <ed3b6b71decf41cb8876c183ba6fdd7e>:0 
  at Microsoft.NET.Build.Tasks.CreateAppHost.ExecuteCore () [0x0009f] in <66b08175c8bd43eda1fda46fdebf1641>:0 
  at Microsoft.NET.Build.Tasks.TaskBase.Execute () [0x0002e] in <66b08175c8bd43eda1fda46fdebf1641>:0 
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <f7274894ce154696afba1f0ffcd06434>:0 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002fc] in <f7274894ce154696afba1f0ffcd06434>:0 

【问题讨论】:

  • 快速修复:运行 ``` chmod -R 644 /usr/share/dotnet/sdk/5.0.102/Sdks ``` 应​​该可以解决问题
  • 谢谢,所以我猜来自微软存储库的标准 dotnet 包的权限与omnisharp 不一致,我可能应该猜到了。我早上一醒来就会使用你的修复程序

标签: c# visual-studio-code omnisharp


【解决方案1】:

Omnisharp 没有访问项目文件的权限。

根据日志,omnisharp 没有访问某些文件的权限。 Access to the path is denied....大概是你正在使用的SDK。

PS:我没有看cmets...对不起。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 2021-06-26
  • 2022-10-31
  • 1970-01-01
  • 1970-01-01
  • 2018-04-03
  • 2016-08-26
  • 2012-08-23
  • 2015-02-15
  • 1970-01-01
相关资源
最近更新 更多