Why is omnisharp not working?

4.4k Views Asked by At

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)
2

There are 2 best solutions below

2
On

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
0
On

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