MonoDevelop: is it possible to switch PCL's compiler?

孤人 提交于 2019-11-29 02:01:30
Mikayla Hutchinson

Mono does not yet have an implementation of the actual PCL libraries. For now, it has a dummy Microsoft.Portable.CSharp.targets file that instead overrides the framework and targets to build the library against MonoTouch, Mono for Android or .NET 4.0, in that order, depending what's installed.

It looks like there's bug in the codepath that uses the MonoTouch framework - it's using the default common targets, Microsoft.CSharp.targets, without overriding the compiler to use the MonoTouch-specific version of the C# compiler. This is necessary because Mono's C# compiler is currently framework-specific (though this is fixed in Mono 2.12, which is in alpha).

You may be able to fix this by editing the file /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets, finding the PropertyGroup that sets

<TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>

And to it, adding the lines:

<CscToolExe>smcs</CscToolExe>
<CscToolPath>/Developer/MonoTouch/usr/bin</CscToolPath>

I know this is an old question, but it appears that Portable Class Library (PCL) support was added to Mono in version 3.0.x, see the Release Notes for details, particularly version 3.0.8 :

Added PCL support to xbuild, mono’s MSBuild implementation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!