Help us understand the problem. What is going on with this article?

MacでC#のソリューションをビルド

More than 5 years have passed since last update.

概要

今回ビルドしたのはこれ。

https://github.com/sta/websocket-sharp

前準備

monoのインストール

brew install mono

xbuildでビルド(エラー編)

$ xbuild websocket-sharp.sln                                                       XBuild Engine Version 12.0
Mono, Version 4.2.0.0
Copyright (C) 2005-2013 Various Mono authors

Build started 2015/12/13 0:28:13.
__________________________________________________
:  warning : Default tasks file /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5/Microsoft.Common.tasks not found, ignoring.
:  warning : Could not find project file /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5/Microsoft.CSharp.targets, to import. Ignoring.
: error : Error initializing task Message: Not registered task Message.
                Build FAILED.
                Warnings:
                :  warning : Default tasks file /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5/Microsoft.Common.tasks not found, ignoring.

エラーとワーニングが出てビルド出来ない。
原因はビルドパスの通ってる場所にMicrosoft.CSharp.targetsとMicrosoft.Common.tasksがないため。

パスを通す

エラーメッセージの場所を見ると確かにない。

$ ls /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5
Microsoft.Build.Engine.dll*         
Microsoft.Build.Framework.dll*      
Microsoft.Build.Tasks.v3.5.dll*     
Microsoft.Build.Utilities.v3.5.dll* Mono.XBuild.Tasks.dll*

4.5を見るとあったのでシンボリックリンクを貼る。

ln -s /usr/local/Cellar/mono/4.2.0.179/lib/mono/4.5/Microsoft.Common.tasks /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5
ln -s /usr/local/Cellar/mono/4.2.0.179/lib/mono/4.5/Microsoft.CSharp.targets /usr/local/Cellar/mono/4.2.0.179/lib/mono/3.5

再びビルド

$ xbuild websocket-sharp.sln

(省略)

Build succeeded.
         0 Warning(s)
         0 Error(s)

成功。

wakaba260
Webエンジニア - Vim, Ruby, ansible, docker
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away