Omnisharp-vscode: Unity projects fixed they said? Not sure...

Created on 1 Aug 2017  路  33Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.1

VS Code version:
1.14.2 public release

C# Extension version:
74e0bd9d842454e1168a2f620797d22c6398d9d3 master trunk

Steps to reproduce

Use this csproj file:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <LangVersion>4</LangVersion>
  </PropertyGroup>
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.20506</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <RootNamespace></RootNamespace>
    <ProjectGuid>{BEDD06D2-DCFB-A6D5-CAC1-1320A679D62A}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <AssemblyName>Assembly-CSharp-Editor</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <BaseDirectory>Assets</BaseDirectory>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>Temp\bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_1_0;UNITY_2017_1;UNITY_2017;PLATFORM_ARCH_64;UNITY_64;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;ENABLE_SPRITE_MASKING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_RMGUI;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_STYLE_SHEETS;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_VR;ENABLE_MODULAR_UNITYENGINE_ASSEMBLIES;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_2_0_SUBSET;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>0169</NoWarn>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>Temp\bin\Release\</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>0169</NoWarn>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.XML" />
    <Reference Include="System.Core" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="UnityEngine">
      <HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll</HintPath>
    </Reference>
    <Reference Include="UnityEditor">
      <HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEditor.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\DefaultComponentInspector.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\EditorUtils.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\EnumFlagsInspector.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\FolderIconEditor.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\GoogleDocsCsvDownloader.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\HtmlColorInspector.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\PatchTargetFramework.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\PostSolutionGenerationAttribute.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\PreBuildProcessing.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\ProjectFoldersGenerator.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\ShaderTemplateGenerator.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\UnityIdentsGenerator.cs" />
     <Compile Include="Assets\LeopotamGroup\EditorHelpers\Editor\UnityLayerInspector.cs" />
     <Compile Include="Assets\LeopotamGroup\SystemUi\Atlases\Editor\EditorIntegration.cs" />
     <Compile Include="Assets\LeopotamGroup\SystemUi\Markup\Editor\EditorIntegration.cs" />
     <Compile Include="Assets\LeopotamGroup\SystemUi\Markup\Editor\MarkupContainerInspector.cs" />
     <Compile Include="Assets\LeopotamGroup\SystemUi\Widgets\Editor\NonVisualWidgetInspector.cs" />
     <None Include="Assets\Hatching\$hatchingHLSL.shader" />
     <None Include="Assets\Resources\test-ui.7.xml" />
     <None Include="Assets\Outline\OutlinePostEffect.shader" />
     <None Include="Assets\Resources\test-ui.9.xml" />
     <None Include="Assets\Resources\test-ui.4.xml" />
     <None Include="Assets\Resources\test-ui.8.xml" />
     <None Include="Assets\Resources\test-ui.1.xml" />
     <None Include="Assets\Plugins\RemoveMe.txt" />
     <None Include="Assets\Icons Package\_Icon Package Read Me.txt" />
     <None Include="Assets\Resources\test-ui.10.xml" />
     <None Include="Assets\LeopotamGroup.Examples\Serialization\test.xml" />
     <None Include="Assets\Resources\test-ui.xml" />
     <None Include="Assets\LeopotamGroup\EditorHelpers\Resources\LeopotamGroup\EditorHelpers\DevConsole.xml" />
     <None Include="Assets\BakeAO\TestAO.shader" />
     <None Include="Assets\Resources\test-ui.3.xml" />
     <None Include="Assets\Resources\test-ui.5.xml" />
     <None Include="Assets\LeopotamGroup.Examples\Serialization\test2.xml" />
     <None Include="Assets\Resources\test-ui.6.xml" />
     <None Include="Assets\quest.txt" />
     <None Include="Assets\Resources\test-ui.2.xml" />
     <None Include="Assets\Resources\test-ui.11.xml" />
 <Reference Include="UnityEditor.Advertisements">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Advertisements/Editor/UnityEditor.Advertisements.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.UI">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.UI">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.Networking">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Networking">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.TestRunner">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TestRunner/Editor/UnityEditor.TestRunner.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.TestRunner">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll</HintPath>
 </Reference>
 <Reference Include="nunit.framework">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.Timeline">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Timeline/RuntimeEditor/UnityEngine.Timeline.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Timeline">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Timeline/Editor/UnityEditor.Timeline.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.TreeEditor">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.Analytics">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/UnityEngine.Analytics.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Analytics">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityAnalytics/Editor/UnityEditor.Analytics.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.HoloLens">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityHoloLens/Editor/UnityEditor.HoloLens.dll</HintPath>
 </Reference>
 <Reference Include="UnityEngine.HoloLens">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Purchasing">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityPurchasing/Editor/UnityEditor.Purchasing.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.VR">
 <HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Graphs">
 <HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEditor.Graphs.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.Android.Extensions">
 <HintPath>/Applications/Unity/PlaybackEngines/AndroidPlayer/UnityEditor.Android.Extensions.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.iOS.Extensions">
 <HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.WebGL.Extensions">
 <HintPath>/Applications/Unity/PlaybackEngines/WebGLSupport/UnityEditor.WebGL.Extensions.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.OSXStandalone.Extensions">
 <HintPath>/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/UnityEditor.OSXStandalone.Extensions.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.iOS.Extensions.Xcode">
 <HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll</HintPath>
 </Reference>
 <Reference Include="UnityEditor.iOS.Extensions.Common">
 <HintPath>/Applications/Unity/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Common.dll</HintPath>
 </Reference>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="Assembly-CSharp-firstpass.csproj">
      <Project>{CD80764A-B5E2-C644-F0D0-A85E486306D8}</Project>      <Name>Assembly-CSharp-firstpass</Name>    </ProjectReference>
    <ProjectReference Include="Assembly-CSharp.csproj">
      <Project>{0279C7A5-B8B1-345F-ED42-A58232A100B3}</Project>      <Name>Assembly-CSharp</Name>    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Expected behavior

All works as at any other IDE.

Actual behavior

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj'.
/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj(1,1)
Microsoft.Build.Exceptions.InvalidToolsetDefinitionException: Cannot evaluate the property expression "$([MSBuild]::GetCurrentExecutableDirectory())" found at "". Invalid static method invocation syntax: "[MSBuild]::GetCurrentExecutableDirectory()". Method '[MSBuild]::GetCurrentExecutableDirectory' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)).  ---> Microsoft.Build.Exceptions.InvalidProjectFileException: Invalid static method invocation syntax: "[MSBuild]::GetCurrentExecutableDirectory()". Method '[MSBuild]::GetCurrentExecutableDirectory' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(`a`, `b`)). 
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object[] args) [0x00042] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.VerifyThrowInvalidProject (System.Boolean condition, System.String errorSubCategoryResourceName, Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object arg0, System.Object arg1) [0x00003] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject (Microsoft.Build.Shared.IElementLocation elementLocation, System.String resourceName, System.Object arg0, System.Object arg1) [0x00000] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2+Function`1[P,I,T].Execute (System.Object objectInstance, Microsoft.Build.Evaluation.IPropertyProvider`1[T] properties, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation) [0x0037b] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2+PropertyExpander`1[P,I,T].ExpandPropertyBody (System.String propertyBody, System.Object propertyValue, Microsoft.Build.Evaluation.IPropertyProvider`1[T] properties, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation, Microsoft.Build.Evaluation.UsedUninitializedProperties usedUninitializedProperties) [0x0012a] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2+PropertyExpander`1[P,I,T].ExpandPropertiesLeaveTypedAndEscaped (System.String expression, Microsoft.Build.Evaluation.IPropertyProvider`1[T] properties, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation, Microsoft.Build.Evaluation.UsedUninitializedProperties usedUninitializedProperties) [0x00187] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2+PropertyExpander`1[P,I,T].ExpandPropertiesLeaveEscaped (System.String expression, Microsoft.Build.Evaluation.IPropertyProvider`1[T] properties, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation, Microsoft.Build.Evaluation.UsedUninitializedProperties usedUninitializedProperties) [0x00000] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2[P,I].ExpandIntoStringLeaveEscaped (System.String expression, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation) [0x00027] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.Expander`2[P,I].ExpandIntoStringAndUnescape (System.String expression, Microsoft.Build.Evaluation.ExpanderOptions options, Microsoft.Build.Shared.IElementLocation elementLocation) [0x00000] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ExpandPropertyUnescaped (Microsoft.Build.Evaluation.ToolsetPropertyDefinition property, Microsoft.Build.Evaluation.Expander`2[P,I] expander) [0x0000e] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
   --- End of inner exception stack trace ---
  at Microsoft.Build.Exceptions.InvalidToolsetDefinitionException.Throw (System.Exception innerException, System.String resourceName, System.String[] args) [0x00014] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ExpandPropertyUnescaped (Microsoft.Build.Evaluation.ToolsetPropertyDefinition property, Microsoft.Build.Evaluation.Expander`2[P,I] expander) [0x00042] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.EvaluateAndSetProperty (Microsoft.Build.Evaluation.ToolsetPropertyDefinition property, Microsoft.Build.Collections.PropertyDictionary`1[T] properties, Microsoft.Build.Collections.PropertyDictionary`1[T] globalProperties, Microsoft.Build.Collections.PropertyDictionary`1[T] initialProperties, System.Boolean accumulateProperties, System.String& toolsPath, System.String& binPath, Microsoft.Build.Evaluation.Expander`2[Microsoft.Build.Execution.ProjectPropertyInstance,Microsoft.Build.Execution.ProjectItemInstance]& expander) [0x000f9] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ReadToolset (Microsoft.Build.Evaluation.ToolsetPropertyDefinition toolsVersion, Microsoft.Build.Collections.PropertyDictionary`1[T] globalProperties, Microsoft.Build.Collections.PropertyDictionary`1[T] initialProperties, System.Boolean accumulateProperties) [0x00032] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ReadEachToolset (System.Collections.Generic.Dictionary`2[TKey,TValue] toolsets, Microsoft.Build.Collections.PropertyDictionary`1[T] globalProperties, Microsoft.Build.Collections.PropertyDictionary`1[T] initialProperties, System.Boolean accumulateProperties) [0x0002a] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ReadToolsets (System.Collections.Generic.Dictionary`2[TKey,TValue] toolsets, Microsoft.Build.Collections.PropertyDictionary`1[T] globalProperties, Microsoft.Build.Collections.PropertyDictionary`1[T] initialProperties, System.Boolean accumulateProperties, System.String& msBuildOverrideTasksPath, System.String& defaultOverrideToolsVersion) [0x0000b] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ToolsetReader.ReadAllToolsets (System.Collections.Generic.Dictionary`2[TKey,TValue] toolsets, Microsoft.Build.Evaluation.ToolsetRegistryReader registryReader, Microsoft.Build.Evaluation.ToolsetConfigurationReader configurationReader, Microsoft.Build.Collections.PropertyDictionary`1[T] environmentProperties, Microsoft.Build.Collections.PropertyDictionary`1[T] globalProperties, Microsoft.Build.Evaluation.ToolsetDefinitionLocations locations) [0x00033] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection.InitializeToolsetCollection (Microsoft.Build.Evaluation.ToolsetRegistryReader registryReader, Microsoft.Build.Evaluation.ToolsetConfigurationReader configReader) [0x0001f] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.IEnumerable`1[T] loggers, System.Collections.Generic.IEnumerable`1[T] remoteLoggers, Microsoft.Build.Evaluation.ToolsetDefinitionLocations toolsetDefinitionLocations, System.Int32 maxNodeCount, System.Boolean onlyLogCriticalEvents) [0x0011d] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties, System.Collections.Generic.IEnumerable`1[T] loggers, Microsoft.Build.Evaluation.ToolsetDefinitionLocations toolsetDefinitionLocations) [0x00000] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at Microsoft.Build.Evaluation.ProjectCollection..ctor (System.Collections.Generic.IDictionary`2[TKey,TValue] globalProperties) [0x00000] in <4a0c3cc04a5a43c2834e89302e708f9c>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.LoadProject (System.String filePath, System.String solutionDirectory, System.String sdksPath, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics, System.Collections.Immutable.ImmutableArray`1[System.String]& targetFrameworks) [0x0003d] in <85c90ba3e7d94a1c80c78423089086c9>:0 
  at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Create (System.String filePath, System.String solutionDirectory, System.String sdksPath, Microsoft.Extensions.Logging.ILogger logger, OmniSharp.Options.MSBuildOptions options, System.Collections.Generic.ICollection`1[T] diagnostics) [0x0000a] in <85c90ba3e7d94a1c80c78423089086c9>:0 
  at OmniSharp.MSBuild.MSBuildProjectSystem.LoadProject (System.String projectFilePath) [0x0003f] in <85c90ba3e7d94a1c80c78423089086c9>:0 
Bug Resolved-Fixed Unity

Most helpful comment

OK. I can see what's happening now. There are two problems conflating here:

  1. Brew's mono cask does not include msbuild, though it probably should.
  2. There's an issue when one of the MSBuild targets tries to load Microsoft.Common.props from $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props but it doesn't exist because $(MSBuildToolsVersion) points to 15.0 but there is no /usr/local/Cellar/mono/5.0.1.1/lib/mono/xbuild/15.0 does not exist. The latest installed there is 14.0.

You can workaround this in one of two ways:

  1. As you've done, use brew cask install mono-mdk, which actually downloads Mono's pkg and installs it. That includes msbuild and everything should generally be happy.
  2. Set the tools version to 14.0 by adding an omnisharp.json file to your project that looks like so:
{
    "MsBuild": {
        "ToolsVersion": "14.0"
    }
}

I have an idea for a fix here as well.

All 33 comments

Hi @Leopotam! What version of Mono do you have installed? Does this project build at a terminal window if you use msbuild Assembly-CSharp-Editor.csproj?

Also, do you have a project that I can use to help replicate this issue? The Unity projects that I tried did not exhibit this problem.

@DustinCampbell

"omnisharp.useMono": false

so, mono version should be ignored.

mono --version

Mono JIT compiler version 4.8.0 (mono-4.8.0-branch/f5fbc32 Mon Nov 14 14:10:00 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          yes(3.6.0svn-mono-master/8b1520c)
    GC:            sgen

While OmniSharp doesn't run on your installed version of Mono, your locally installed Mono will still be used for non-.NET Core projects. It's used to acquire frameworks and references assemblies, and MSBuild tasks and targets. I recommend to the latest beta release) of Mono, 5.2.0.213, or at least the latest stable release, 5.0.1.1.

Does this project build at a terminal window if you use invoke msbuild Assembly-CSharp-Editor.csproj?

I just built package of plugin, remove old one from vscode, restart, install new from package, restart and open already created solution. Plugin downloaded / installed dependencies and then start to scan solution. Then this error log appeared at vscode log panel. I didnt any attempts to build solution outside from vscode, because i want to do it inside IDE.

@DustinCampbell so, if i will remove system mono installation - it should fix issue and builtin mono version of this plugin will be used?

@DustinCampbell with mono 5.0.1.1 - another error message:

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Could not write lines to file "/Debug/Assembly-CSharp-Editor.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp-Editor.csproj.CoreCompileInputs.cache".
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj'.
/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj

Looks like it try to write at absolute path (to root folder /Debug) instead of relative path:

<OutputPath>Temp\bin\Debug\</OutputPath>

So, if i will remove system mono installation - it should fix issue and builtin mono version of this plugin will be used?

No, we don't include all of the reference assemblies, targets and MSBuild tasks needed by your project. OmniSharp only includes a small Mono runtime and set of framework assemblies to run itself on.

Also, did you try mono 5.2.0.213?

@DustinCampbell no, why? I even dont need mono 4.x/5.x or dotnet at system level - unity has builtin patched mono that will be used for real builds. I just need IDE that will be independent on any system libraries. Like jetbrains rider, or xamarin studio.

It doesn't have to do with using system libraries. As I mentioned, the MSBuild targets, tasks, and reference assemblies laid down by the Mono installation are used to handle things like IntelliSense. OmniSharp is simply using MSBuild as an API to resolve the files and references and references in your project. That requires running MSBuild targets and tasks, which need to be somewhere on your system. For projects that target .NET Framework, OmniSharp tries to locate the Mono that is installed on your system and use the MSBuild assets installed with it.

The sorts of errors you're getting lead me to believe that there is a bug in the MSBuild targets that are being loaded, not necessarily in OmniSharp itself. If you're provide a project that reproduces the issue, I'll take a look.

Thanks! I'll take a look at this when I get back to my Mac.

Sorry for the delay on this. I just tried the project you provided with the 1.12.0-beta4 build of C# for VS Code and Mono 5.0.1.1 installed, and could not reproduce the issue. Have you set your preferences in VS Code to use a different omnisharp-roslyn build?

@DustinCampbell
Settings of c# plugin:

"csharp.suppressHiddenDiagnostics": false

Plugin version:
74e0bd9d842454e1168a2f620797d22c6398d9d3 commit from master.

Log from vscode:

Starting OmniSharp server at 8/8/2017, 9:30:12 AM
    Target: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln

OmniSharp server started wth Mono
    Path: /Users/leopotam/.vscode/extensions/ms-vscode.csharp-1.12.0-beta4/bin/run
    PID: 1421

OmniSharp: -s /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln --hostPID 1401 --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 '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary' on host 1401."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary
[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
        Omnisharp will use local MSBuild.
    MSBUILD_EXE_PATH: /Users/leopotam/.vscode/extensions/ms-vscode.csharp-1.12.0-beta4/bin/omnisharp/msbuild/MSBuild.dll
    MSBuildExtensionsPath: /usr/local/Cellar/mono/5.0.1.1/lib/mono/xbuild
    TargetFrameworkRootPath: /usr/local/Cellar/mono/5.0.1.1/lib/mono/xbuild-frameworks

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        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.MSBuildProjectSystem
        Failed to load project file '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp.csproj'.
/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-firstpass.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Could not write lines to file "/Debug/Assembly-CSharp-firstpass.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp-firstpass.csproj.CoreCompileInputs.cache".
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-firstpass.csproj'.
/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-firstpass.csproj

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj
[warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
[fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo
        Could not write lines to file "/Debug/Assembly-CSharp-Editor.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp-Editor.csproj.CoreCompileInputs.cache".
[warn]: OmniSharp.MSBuild.MSBuildProjectSystem
        Failed to load project file '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj'.
/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj

[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Services.WorkspaceHelper
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

Clearing of output folder (Temp/bin/Debug) not helped - plugin created empty folders again with same errors.

It looks to me like it's trying to create a top-level directory, /Debug instead of using obj/Debug relative to your project file for some reason.

I am able to repro the problem. I'm not sure why yet, but the issue occurs if I install Mono 5.0.1.1 via Homebrew rather than use pkg at http://www.mono-project.com/download/

@DustinCampbell yes, homebrew central repository is must instead of standalone somewhere / somehow packages / installers.

I was just able to fix the issue by running brew cask install mono-mdk rather than brew install mono.

@DustinCampbell confirmed, no fails:

Starting OmniSharp server at 8/8/2017, 1:34:54 PM
    Target: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln

OmniSharp server started wth Mono
    Path: /Users/leopotam/.vscode/extensions/ms-vscode.csharp-1.12.0-beta4/bin/run
    PID: 1876

OmniSharp: -s /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln --hostPID 1860 --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 '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary' on host 1860."},"Seq":1,"Type":"event"}
[info]: OmniSharp.DotNet.DotNetProjectSystem
        Initializing in /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary
[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
        OmniSharp initialized with Mono MSBuild.
    MSBUILD_EXE_PATH: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/MSBuild.dll
    MSBuildExtensionsPath: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/xbuild
    TargetFrameworkRootPath: /Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/xbuild-frameworks
    RoslynTargetsPath: /Users/leopotam/.vscode/extensions/ms-vscode.csharp-1.12.0-beta4/bin/omnisharp/msbuild/Roslyn

[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Detecting projects in '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/LeopotamGroupLibrary.sln'.
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp.csproj
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-firstpass.csproj
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Loading project: /Users/leopotam/Documents/unity/private/LeopotamGroupLibrary/Assembly-CSharp-Editor.csproj
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: Assembly-CSharp
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: Assembly-CSharp-firstpass
[info]: OmniSharp.MSBuild.MSBuildProjectSystem
        Update project: Assembly-CSharp-Editor
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/leopotam/Documents/unity/private/LeopotamGroupLibrary'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.Services.WorkspaceHelper
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.Startup
        Configuration finished.

great! Now I just need to figure out why this happens. :smile:

Maybe reason in different paths and ways to install:

  • mono package installed to /usr/local/Cellar/mono/ and should be linked with "brew link mono".
  • mono-mdk installed to system folder /Library/Frameworks/Mono.framework/Versions/ without linking.

no, it looks to me like the big difference is that "brew install mono" does not install the Mono's msbuild.

In the error case, it looks like the problem is that BaseIntermediateOutputPath is set to / for some reason. That results in the CoreCompile target trying to write information to /Debug/. Hmmm...

OK. I can see what's happening now. There are two problems conflating here:

  1. Brew's mono cask does not include msbuild, though it probably should.
  2. There's an issue when one of the MSBuild targets tries to load Microsoft.Common.props from $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props but it doesn't exist because $(MSBuildToolsVersion) points to 15.0 but there is no /usr/local/Cellar/mono/5.0.1.1/lib/mono/xbuild/15.0 does not exist. The latest installed there is 14.0.

You can workaround this in one of two ways:

  1. As you've done, use brew cask install mono-mdk, which actually downloads Mono's pkg and installs it. That includes msbuild and everything should generally be happy.
  2. Set the tools version to 14.0 by adding an omnisharp.json file to your project that looks like so:
{
    "MsBuild": {
        "ToolsVersion": "14.0"
    }
}

I have an idea for a fix here as well.

@DustinCampbell well, best solution - have no (decrease to minimum) external dependencies with fixed versions or download them manually to plugin folder (as you already do for some binaries).
For example, plugin with 1.11 version (last release) have no any requirements of any custom installations of dotnet or mono with special versions at system level (uses old system mono, why not?) - and its very good for users of this plugin.

Unfortunately, that would effectively mean downloading nearly all of Mono locally, which would be too much. That's just not a possible solution here.

As I mentioned before, the issue is locating the correct version of the assemblies that your project references. These cannot live inside C# for VS Code. For Unity development, Mono is the appropriate way to get these.

@DustinCampbell why not? JetBrains Rider IDE works without problems / any system installations. You release new version of this plugin not very often, so first time user can wait. It can be optional feature for example. Another solution - download only msbuild part to plugin folder and use system mono / homebrew installation.

Building a full system for downloading various SDKs is a bit out of the scope of what we're trying to do with C# for VS Code. IMO, that's a bit outside of the realm of a lightweight editor like VS Code and is more the behavior of an IDE. We do include MSBuild with OmniSharp to use as a fall back, but building in an aquisition mechanism to download the legacy .NET Framework bits that Unity requires is definitely something that is more appropriate for an IDE like Rider. Do note that VS Code does not claim or try to be on par with Rider. If you are interested in a full-service IDE, I'd recommend Visual Studio for Mac.

@DustinCampbell I see, thanks for your time, no need to fix this issue then. Its not issue but feature. :)

@Leopotam: I am fixing the issue. However, I'm not fixing it by introducing a custom acquisition system for downloading the reference assemblies for your project. I'm that's not good enough for your needs, I apologize.

Thanks @grofie!

If you are using Unity and also have this problem too, please try out the fix I explained here and give me feedback if it is working for you too: https://github.com/dotBunny/VSCode/issues/165#issuecomment-394347070

(Sorry, my first attempt was not fully matured, but hopefully it is working now)

Was this page helpful?
0 / 5 - 0 ratings