V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
bwangel
V2EX  ›  Vim

安装 YouCompleteMe 的 OmniSharpServer 出现了一个错误

  •  
  •   bwangel · 2016-04-22 22:43:54 +08:00 · 7586 次点击
    这是一个创建于 3138 天前的主题,其中的信息可能已经有所发展或是发生改变。

    换了一个系统, xubuntu14 ,然后今天安装 YCM 的时候出错了错误,我的安装指令是./install.py -all

    msbuild or xbuild is required to build Omnisharp
    

    后来查到了这篇回答,why-is-omnisharp-not-working,看到了 programingfrik 的答案,说是omnisharp没能正确安装,于是我切换到YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer目录下,执行了一下安装指令

    git checkout master
    git submodule update --init --recursive
    sudo apt-get install mono-xbuild
    xbuild
    

    然后又报错了,这回不知道该咋办了,特来向 V 友们求助!

    我的分支和 mono 版本是这样的:

    ➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ git branch -v
    * master e190291 Merge pull request #207 from micbou/drive-letter
    ➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ mono --version
    Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1.1)
    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
    

    报的错误是这样的:

    ➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ xbuild
    XBuild Engine Version 12.0
    Mono, Version 3.2.8.0
    Copyright (C) 2005-2013 Various Mono authors
    
    Build started 4/22/2016 10:44:14 PM.
    __________________________________________________
    Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln" (default target(s)):
    	Target ValidateSolutionConfiguration:
    		Building solution configuration "Debug|Any CPU".
    	Target Build:
    		Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj" (default target(s)):
    			Target PrepareForBuild:
    : error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    			Task "Message" execution -- FAILED
    			Done building target "PrepareForBuild" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
    			Target _RecordCleanFile:
    : error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    			Task "ReadLinesFromFile" execution -- FAILED
    			Done building target "_RecordCleanFile" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
    		Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
    		Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj" (default target(s)):
    			Target PrepareForBuild:
    : error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    			Task "Message" execution -- FAILED
    			Done building target "PrepareForBuild" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
    			Target _RecordCleanFile:
    : error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    			Task "ReadLinesFromFile" execution -- FAILED
    			Done building target "_RecordCleanFile" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
    		Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
    	Task "MSBuild" execution -- FAILED
    	Done building target "Build" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln".-- FAILED
    Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln".-- FAILED
    
    Build FAILED.
    Errors:
    
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
    (Build target) ->
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj (default targets) ->
    /usr/lib/mono/4.5/Microsoft.Common.targets (PrepareForBuild target) ->
    
    	: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
    (Build target) ->
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj (default targets) ->
    /usr/lib/mono/4.5/Microsoft.Common.targets (_RecordCleanFile target) ->
    
    	: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
    (Build target) ->
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj (default targets) ->
    /usr/lib/mono/4.5/Microsoft.Common.targets (PrepareForBuild target) ->
    
    	: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
    (Build target) ->
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj (default targets) ->
    /usr/lib/mono/4.5/Microsoft.Common.targets (_RecordCleanFile target) ->
    
    	: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
    
    	 0 Warning(s)
    	 4 Error(s)
    
    Time Elapsed 00:00:00.5894150
    

    望 V 友们给个提示呗,这是啥错误啊,从哪里入手解决!

    第 1 条附言  ·  2016-04-23 16:21:03 +08:00

    折腾了一下,决定不整了,记录一下我折腾的情况吧!

    首先,发现自己装的时候装错了,我安装YCM的时候,用的是./install.py -all,这是默认安装所有特性,其中就包括了,C#的补全(./install.py --omnisharp-completer)而报错的这个OmniSharpServer库,正是C#的补全库!,什么鬼,Linux下写C#这种事情我根本不会干好伐!

    但是觉得已经开搞了,不试着解决解决总是怪怪的,于是找了一下解决方案,发现我少装了两个包,又装了这么两个包 !

    sudo apt-get install libmono-microsoft-build-tasks-v4.0-4.0-cil
    sudo apt-get install mono-dmcs
    
    第 2 条附言  ·  2016-04-23 16:21:57 +08:00

    但是还是报错啊,错误是这样的:

    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
    (Build target) ->
    /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp/OmniSharp.csproj (default targets) ->
    /usr/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
    
    	: error CS8001: Warning as Error: SDK path could not be resolved
    

    然后我就无解了,最终决定放弃,因为我根本不会在VIM中写C#啊,感觉自己真是闲的蛋疼!

    2 条回复    2016-04-27 02:34:40 +08:00
    bwangel
        1
    bwangel  
    OP
       2016-04-23 16:23:25 +08:00
    报错的编译命令是好长好长的一句, V2 贴不上来啊!
    dcoder
        2
    dcoder  
       2016-04-27 02:34:40 +08:00
    @bwangel
    所以我现在已经不用 YCM 了, 又肥又重又易出错...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5559 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 08:26 · PVG 16:26 · LAX 00:26 · JFK 03:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.