【发布时间】: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