OmniSharp is not able to process .csproj files from Unity projects generated using Unity VSCode plugin,
dotnet --info output:
.NET Command Line Tools (1.0.0-preview2-1-003177)
Product Information:
Version: 1.0.0-preview2-1-003177
Commit SHA-1 hash: a2df9c2576
Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
VS Code version: 1.10.1
C# Extension version: 1.7.0
Open a unity project in VSCode
Dispose of all C# advanced tools like intellisense and others.
OmniSharp fails to proces .csproj files and no advanced features are available.
...
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to process project file '/path/to/project/Assembly-CSharp.csproj'.
...
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to process project file '/path/to/project/Assembly-CSharp-Editor-firstpass.csproj'.
...
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/path/to/project'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.Startup
Configuration finished.
Could you provide the full OmniSharp log rather than abbreviating it?
Full log output:
Starting OmniSharp server at 3/2/2017, 3:01:23 PM
Target: /path/to/project/unity.sln
OmniSharp server started wth Mono
Path: /path/to/.vscode/extensions/ms-vscode.csharp-1.7.0/bin/run
PID: 5387
OmniSharp: -s /path/to/project/unity.sln --hostPID 5284 --stdio DotNet:enablePackageRestore=false --encoding utf-8 --loglevel information formattingOptions:useTabs=false formattingOptions:tabSize=4 formattingOptions:indentationSize=4
锘匡豢{"Event":"log","Body":{"LogLevel":"INFORMATION","Name":"OmniSharp.Startup","Message":"Omnisharp server running using Stdio at location '/path/to/project' on host 5284."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
Initializing in /path/to/project
[info]: OmniSharp.DotNet.DotNetProjectSystem
Auto package restore: False
[info]: OmniSharp.DotNet.DotNetProjectSystem
Update workspace context
[info]: OmniSharp.DotNet.DotNetProjectSystem
Resolving projects references
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
MSBUILD_EXE_PATH environment variable set to /path/to/.vscode/extensions/ms-vscode.csharp-1.7.0/bin/omnisharp/msbuild/MSBuild.dll
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
MSBuildExtensionsPath environment variable set to /path/to/.vscode/extensions/ms-vscode.csharp-1.7.0/bin/omnisharp/msbuild
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
MSBuildSDKsPath environment variable set to /path/to/.vscode/extensions/ms-vscode.csharp-1.7.0/bin/omnisharp/msbuild/Sdks
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Detecting projects in '/path/to/project/unity.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Loading project from '/path/to/project/Assembly-CSharp.csproj'.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to process project file '/path/to/project/Assembly-CSharp.csproj'.
/path/to/project/Assembly-CSharp.csproj(1,1)
System.InvalidOperationException: The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation (System.String resourceName, System.Object[] args) [0x00019] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation (System.Boolean condition, System.String resourceName, System.Object arg0, System.Object arg1, System.Object arg2) [0x0000a] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Shared.FileUtilities+ItemSpecModifiers.GetItemSpecModifier (System.String currentDirectory, System.String itemSpec, System.String definingProjectEscaped, System.String modifier, System.String& fullPath) [0x004f2] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Evaluation.BuiltInMetadata.GetMetadataValueEscaped (System.String currentDirectory, System.String evaluatedIncludeBeforeWildcardExpansionEscaped, System.String evaluatedIncludeEscaped, System.String definingProjectEscaped, System.String name, System.String& fullPath) [0x0002e] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetBuiltInMetadataEscaped (System.String name) [0x00012] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetMetadataEscaped (System.String metadataName) [0x000ce] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetMetadata (System.String metadataName) [0x00001] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at (wrapper remoting-invoke-with-check) Microsoft.Build.Execution.ProjectItemInstance+TaskItem:GetMetadata (string)
at Microsoft.Build.Execution.ProjectItemInstance.GetMetadataValue (System.String name) [0x00001] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.GetFullPaths (System.Collections.Generic.ICollection`1[T] items) [0x0001b] in <aca7f87b64bc414f95aff1158193a80c>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create (System.String projectFilePath, System.String solutionDirectory, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics, System.Boolean isUnityProject) [0x00309] in <aca7f87b64bc414f95aff1158193a80c>:0
at OmniSharp.MSBuild.MSBuildProjectSystem.CreateProjectFileInfo (System.String projectFilePath, System.Boolean isUnityProject) [0x0001f] in <aca7f87b64bc414f95aff1158193a80c>:0
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
Loading project from '/path/to/project/Assembly-CSharp-Editor-firstpass.csproj'.
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
Failed to process project file '/path/to/project/Assembly-CSharp-Editor-firstpass.csproj'.
/path/to/project/Assembly-CSharp-Editor-firstpass.csproj(1,1)
System.InvalidOperationException: The item metadata "%(FullPath)" cannot be applied to the path "//mscorlib.dll". UNC paths should be of the form \\server\share.
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation (System.String resourceName, System.Object[] args) [0x00019] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation (System.Boolean condition, System.String resourceName, System.Object arg0, System.Object arg1, System.Object arg2) [0x0000a] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Shared.FileUtilities+ItemSpecModifiers.GetItemSpecModifier (System.String currentDirectory, System.String itemSpec, System.String definingProjectEscaped, System.String modifier, System.String& fullPath) [0x004f2] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Evaluation.BuiltInMetadata.GetMetadataValueEscaped (System.String currentDirectory, System.String evaluatedIncludeBeforeWildcardExpansionEscaped, System.String evaluatedIncludeEscaped, System.String definingProjectEscaped, System.String name, System.String& fullPath) [0x0002e] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetBuiltInMetadataEscaped (System.String name) [0x00012] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetMetadataEscaped (System.String metadataName) [0x000ce] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at Microsoft.Build.Execution.ProjectItemInstance+TaskItem.GetMetadata (System.String metadataName) [0x00001] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at (wrapper remoting-invoke-with-check) Microsoft.Build.Execution.ProjectItemInstance+TaskItem:GetMetadata (string)
at Microsoft.Build.Execution.ProjectItemInstance.GetMetadataValue (System.String name) [0x00001] in <6a1392588f4a45bdbe07807130f9b3d0>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.GetFullPaths (System.Collections.Generic.ICollection`1[T] items) [0x0001b] in <aca7f87b64bc414f95aff1158193a80c>:0
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create (System.String projectFilePath, System.String solutionDirectory, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics, System.Boolean isUnityProject) [0x00309] in <aca7f87b64bc414f95aff1158193a80c>:0
at OmniSharp.MSBuild.MSBuildProjectSystem.CreateProjectFileInfo (System.String projectFilePath, System.Boolean isUnityProject) [0x0001f] in <aca7f87b64bc414f95aff1158193a80c>:0
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/path/to/project'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.Startup
Configuration finished.
Thanks! I've seen this error once before and it was related to an older version of Mono installed on the machine. Could you run mono --version in a terminal window and let me know the output?
Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
Thanks for confirming. Updating Mono on your machine should fix the issue. This is the same issue as https://github.com/OmniSharp/omnisharp-vscode/issues/1213.
I upgraded Mono to latest version following instructions from oficial site and can confirm that issue is fixed.
Thanks @DustinCampbell!
Hi @vonbloom , I got the same problem, and I reinstalled mono, both by the official pkg and brew. The problem was still not solved. Finally the Unity plugin "VSCode" made it work.
When I review the structure after that, I found it removed both
ProjectName.csproj and
ProjectName.Editor.csproj.
Hope this can help others.
Most helpful comment
Hi @vonbloom , I got the same problem, and I reinstalled mono, both by the official pkg and brew. The problem was still not solved. Finally the Unity plugin "VSCode" made it work.
When I review the structure after that, I found it removed both
ProjectName.csproj and
ProjectName.Editor.csproj.
Hope this can help others.