sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.73k stars 1.66k forks source link

Can't build on Mono (OSX) #292

Open Miscellaneous opened 8 years ago

Miscellaneous commented 8 years ago

Error: ./Assets/websocket-sharp/websocket-sharp.csproj: ./Assets/websocket-sharp/websocket-sharp.csproj could not import "$(MSBuildBinPath)\Microsoft.CSharp.targets" (websocket-sharp)

ghost commented 8 years ago

Hi, I have had the same problem and solved using xbuild. If you installed unity, you should use xbuild command.

In command line,

xbuild (path to websocket-sharp project path)/websocket-sharp.sln

however, it will probably display warning and error messages.

They are "Microsoft.Common.tasks not found" and "Microsoft.CSharp.targets not found". You need to link Microsoft.Common.tasks and Microsoft.CSharp.targets.

For example, my development environment is

:  warning : Default tasks file /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5/Microsoft.Common.tasks not found, ignoring.
/Users/Tsuyoshi/WorkSpace/github/websocket-sharp/websocket-sharp/websocket-sharp.csproj:  warning : Could not find project file /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5/Microsoft.CSharp.targets, to import. Ignoring.
Project "/Users/Tsuyoshi/WorkSpace/github/websocket-sharp/websocket-sharp.sln" (default target(s)):
    Target ValidateSolutionConfiguration:
: error : Error initializing task Message: Not registered task Message.
        Build FAILED.
        Warnings:
        :  warning : Default tasks file /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5/Microsoft.Common.tasks not found, ignoring.
        /Users/Tsuyoshi/WorkSpace/github/websocket-sharp/websocket-sharp/websocket-sharp.csproj:  warning : Could not find project file /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5/Microsoft.CSharp.targets, to import. Ignoring.
        Errors:
        /Users/Tsuyoshi/WorkSpace/github/websocket-sharp/websocket-sharp.sln (default targets) ->
        (ValidateSolutionConfiguration target) ->
            : error : Error initializing task Message: Not registered task Message.
             2 Warning(s)
             1 Error(s)
        Time Elapsed 00:00:00.1988430

As below,

sudo ln -s /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5/Microsoft.Common.targets /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5

sudo ln -s /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5/Microsoft.CSharp.targets /Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/3.5

I have fixed the link of Microsoft.Common.targets and Microsoft.CSharp.targets. Build again, it might be successful.

Thank you.