OmniSharp / omnisharp-server

HTTP wrapper around NRefactory allowing C# editor plugins to be written in any language.
http://www.omnisharp.net
MIT License
380 stars 97 forks source link

could not find assembly reference (Linux, wine, and Unity3D) #186

Closed liefswanson closed 9 years ago

liefswanson commented 9 years ago

Hi, I am currently trying to use Omnisharp Arch Linux.

More specifically I am trying to hook it up to a Unity3D project. Now because I am in linux Unity is installed through wine, and I am certain this is the cause of my woes.

Right now it is complaining that it cannot find Assemblies certain assemblies. I understand it not being able to find most of them, but the System.XML confuses me... I see that System.Xml.linq is found though... does this mean that this is a problem to do with the case insensitivity of windows? vs the case sensitivity of linux?

00000059 Using solution path /home/lief/projects/unity-test/unity-test/New Unity Project/New Unity Project-csharp.sln
00000068 Using config file /home/lief/OmniSharpServer/OmniSharp/bin/Debug/config.json
Error: did not find one of the files in sources//usr/lib/monodoc/sources/gd2i
node `classlib-webkit' is not defined on the documentation map
00001424 OmniSharp server is listening
/usr/lib/mono/4.5/mscorlib.dll
00001721 Loading project - New Unity Project, /home/lief/projects/unity-test/unity-test/New Unity Project/Assembly-CSharp-vs.csproj, {B2B58FB2-4462-6B0C-A872-40DD957E5FE0}
00001738 Loading /home/lief/projects/unity-test/unity-test/New Unity Project/Assets/NewBehaviourScript.cs
00001827 Loading assembly System
00001965 Could not find referenced assembly System.XML
00001965 Loading assembly System.Core
00001998 Loading assembly System.Xml.Linq
00002010 Could not find referenced assembly UnityEngine
00002010 Could not find referenced assembly UnityEditor
00002010 Could not find referenced assembly UnityEngine.UI
00002011 Solution has finished loading

Now if I find these (in theory they would be inside the unity install somewhere maybe? probably not in the project?...) and add them to my path should that be enough? (forgive me I am not very experience with .NET assemblies)

Or should I be trying to run Omnisharp inside wine as well, and execute it as if it were in windows? ...And if that is the case, how would I hook emacs up to it, or can I just do what I normally do?

EDIT: As a note I did find the dlls in question inside my unity install, except for System.XML

nosami commented 9 years ago

Oh man... I don't know where to start with this... talk about an esoteric set up :)

What I can tell you is that archlinux by itself is fine, that's what I use. As for Unity + Wine, I really have no idea!!

Does Unity not run natively on linux?

To fix your System.XML issue, you could try hand editing your generated /home/lief/projects/unity-test/unity-test/New Unity Project/Assembly-CSharp-vs.csproj file to change the case.

And GAC references aren't supported outside Windows by OmniSharp..... you would probably have better luck with copying them to a ./lib folder and referencing them directly.

liefswanson commented 9 years ago

Ya i know it is a weird setup hahaha. (but isn't it beautiful that it is theoretically possible?...)

No Unity has no native linux version (wouldn't that be wonderful). I really can't stand working on my stuff in windows, though I may just bite the bullet for this one and grab the windows version of emacs. I do dualboot for this eventuality...

So that .lib folder would be inside my project? Right at the root level where the .sln is? Do I need to do anything special to let omnisharp know it is there?

Will omnisharp need anything else other than those dlls? such as will it need the dlls they rely on (if any, or does it more or less just need something to point to in order to syntax check?)

can omnisharp follow symlinks?

liefswanson commented 9 years ago

Also I apologize for the riddled mess of typos and poor grammar, half distracted and not proof reading very well.... hahaha

liefswanson commented 9 years ago

Oh I think I am seeing now, I should be able to give a path to the dll in the .csproj file?

Like a hint where to look for said library? Or is that what you meant by the GAC not being able to support references? Hopefully that doesn't break things inside unity... we will see, that is why we have test projects...

liefswanson commented 9 years ago

oh dear god it worked...

00000060 Using solution path /home/lief/projects/unity-test/unity-test/New Unity Project/New Unity Project-csharp.sln
00000069 Using config file /home/lief/OmniSharpServer/OmniSharp/bin/Debug/config.json
Error: did not find one of the files in sources//usr/lib/monodoc/sources/gd2i
node `classlib-webkit' is not defined on the documentation map
00001423 OmniSharp server is listening
/usr/lib/mono/4.5/mscorlib.dll
00001733 Loading project - New Unity Project, /home/lief/projects/unity-test/unity-test/New Unity Project/Assembly-CSharp-vs.csproj, {B2B58FB2-4462-6B0C-A872-40DD957E5FE0}
00001749 Loading /home/lief/projects/unity-test/unity-test/New Unity Project/Assets/NewBehaviourScript.cs
00001838 Loading assembly System
00001974 Loading assembly System.Xml
00002009 Loading assembly System.Core
00002051 Loading assembly System.Xml.Linq
00002056 Loading assembly UnityEngine
00002347 Loading assembly UnityEditor
00002552 Loading assembly UnityEngine.UI
00002563 Solution has finished loading

thanks for the feedback nosami, I freaking love the work you have done on Omnisharp.

I just changed the path hints in the csproj to properly reflect what omnisharp could actually see, as it wasn't blindfolded by wine like unity is. Anyway I should be able to find my way out of the dark here now, even if it means making a separate sln and csproj that unity doesn't know about... (so it can't continually change them on me.)

eg. was

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.XML" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="UnityEngine">
      <HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
    </Reference>
    <Reference Include="UnityEditor">
      <HintPath>C:/Program Files/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
     <Compile Include="Assets\NewBehaviourScript.cs" />
 <Reference Include="UnityEngine.UI">
 <HintPath>C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
 </Reference>
  </ItemGroup>

now it is

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="UnityEngine">
      <HintPath>/home/lief/.PlayOnLinux/wineprefix/Unity3D/drive_c/Program Files/Unity/Editor/Data/Managed/UnityEngine.dll</HintPath>
    </Reference>
    <Reference Include="UnityEditor">
      <HintPath>/home/lief/.PlayOnLinux/wineprefix/Unity3D/drive_c/Program Files/Unity/Editor/Data/Managed/UnityEditor.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
     <Compile Include="Assets\NewBehaviourScript.cs" />
 <Reference Include="UnityEngine.UI">
 <HintPath>/home/lief/.PlayOnLinux/wineprefix/Unity3D/drive_c/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath>
 </Reference>
  </ItemGroup>

inside "Assembly-Csharp-vs.csproj"

Now, hopefully we can just keep this hear for documentation sake.

And as a note. I just checked this inside Emacs and it does in fact work

nosami commented 9 years ago

glad you got it working!