1

I have recently installed emacs 24.3.1 I have installed package omnisharp using melpa in Emacs.

But, I can't see any effects of omnisharp on my Emacs while programming in C#. Do I need to install something else also, or am I doing something wrong here?

While compiling the Omnisharp Server, I am recieving the following error log :-

/home/pratik/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/pratik/OmniSharpServer/OmniSharp.Tests/OmniSharp.Tests.csproj (default         targets) ->
/usr/lib/mono/4.0/Microsoft.CSharp.targets (CoreCompile target) ->

FindUsages/IntegrationTest.cs(39,27): error CS0584: Internal compiler error: Method not found: 'Nancy.Testing.BrowserResponseExtensions.BodyAsXml'.
FindUsages/IntegrationTest.cs(41,20): error CS1061: Type `object' does not contain a definition for `Length' and no extension method `Length' of type `object' could be found (are you missing a using directive or an assembly reference?)
FindUsages/IntegrationTest.cs(42,19): error CS0021: Cannot apply indexing with [] to an expression of type `object'
FindUsages/IntegrationTest.cs(43,19): error CS0021: Cannot apply indexing with [] to an expression of type `object'

 31 Warning(s)
 4 Error(s)
Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97
  • Do you have omnisharp server started? – BartoszKP Jul 28 '14 at 11:44
  • No, I tried downloading it and building it like described [here](https://github.com/nosami/OmniSharpServer) but unable to find the omniserver.exe file – Pratik Singhal Jul 28 '14 at 12:51
  • So if you can't find omniserver.exe then the build failed. There should be some error messages in msbuild log. – BartoszKP Jul 28 '14 at 12:54
  • Please check the error logs – Pratik Singhal Jul 28 '14 at 12:59
  • Seems you need this assembly: https://github.com/NancyFx – BartoszKP Jul 28 '14 at 13:03
  • Thanks for the help, but I am unable to install the Nancy pakcage,nor can I find any place with build instructions where I might build this library from source. How can I do that ? – Pratik Singhal Jul 28 '14 at 13:42
  • Their [website](http://nancyfx.org/) suggests that the easiest way is to use NuGet. – BartoszKP Jul 28 '14 at 14:18
  • You don't need to use nuget to install the dependencies as I included them in git. At the time, nuget had problems on certain versions of linux, so this seemed the easiest way. Are you using linux or OSX? There have been known issues with using the homebrew version of mono. Which version of mono are you using? – jasoni Aug 13 '14 at 20:14

2 Answers2

3

I am running through the same path as you (*nix + emacs + omnisharp). The answer to your problem is in the OmniSharpServer git page (https://github.com/nosami/OmniSharpServer). You have mono on your system, so you have to clone the OmniSharpServerRepository and execute this lines in a shell:

git clone https://github.com/nosami/OmniSharpServer.git
cd OmniSharpServer
git submodule update --init --recursive
xbuild

If xbuild complained about some assemblies missing something is wrong with the git submodule update --init --recursive. As long as you get the "N Error(s)" message at the bottom you wont find any binary (exe or dll) in the project. If you solve the errors the binaries should be at "OmniSharpServer/OmniSharp/bin/Debug".

You should include the complete compiler output in the question. If you also provide some info about your environment it would be easier to help you. Please execute this lines as well in the OmniSharpServer directory (I want to see if you are looking at the last version of the master branch and I want to see the mono version you are using):

git branch -v
mono --version
programingfrik
  • 309
  • 2
  • 10
  • I tried your solution , and it's the same 4 errors that are coming again. As for the compiler output, I have already included it in the question, please check it. – Pratik Singhal Aug 21 '14 at 03:45
  • 1
    Ok, I made a mistake, the four error were already there, but a lot of info is missing. Are you **sure** that this is all you get from "xbuild" in the shell. I think you are using some MonoDevelop or something else that doesn't show the whole output. Please execute xbuild directly and if you still get the errors show that and extra information that I ask for in my edited answer. – programingfrik Aug 22 '14 at 17:08
1

I had the same error and noticed that there's a version conflict. You need to install mono-devel on Ubuntu:

sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo echo "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
apt-get install mono-devel

When that's complete you should be able to launch the server:

mono OmniSharp/bin/Debug/OmniSharp.exe
jarederaj
  • 1,350
  • 13
  • 18