LoginSignup
6

More than 5 years have passed since last update.

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

Last updated at Posted at 2015-12-12

概要

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

前準備

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)

成功。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6