0
votes

When I try to build my Xamarin iOS project, I get this error:

/Library/Frameworks/Mono.framework/Versions/5.0.1/lib/mono/msbuild/15.0/bin/Roslyn/Microsoft.CSharp.Core.targets(5,5): Error MSB6006: "csc.exe" exited with code 1. (MSB6006)

Seems it's because of Mono 5.0, but I don't know how to fix it!

2

2 Answers

2
votes

There's actually an upstream bug in Roslyn related to compiling projects that include async partial methods that's causing this.

Public bug 56246 on the Xamarin bug tracker has been filed to track the inclusion of the upstream "csc.exe" fix into Mono 5.0.

Mono 5.0 and Mono 4.8.1 both include mcs (Mono's compiler) and csc, however, Mono 4.8.1 uses mcs by default while 5.0 uses csc by default.

While waiting for the fix to make it to the Xamarin environment, there is a temporary workaround that should get you up and running. You can temporarily switch back to using mcs and xbuild in Mono 5.0:

  1. Add the following PropertyGroup element to the bottom of the .csproj file for your app project just before the closing </Project> tag:

    <PropertyGroup Condition=" '$(OS)' == 'Unix' "> <CscToolExe>mcs.exe</CscToolExe> </PropertyGroup>

  2. Disable Visual Studio > Preferences > Build > Build with MSBuild instead of xbuild.

  3. Close, then reopen the solution and double check the new setting.

  4. Clean and rebuild.

0
votes

Try downloading and installing Mono 4.8. You will need to be careful if you're using VS for Mac which requires Mono 5.0 or greater. If that is the case you should be able to download 4.8 without making it the default and then change the .NET Runtime in preferences after launching VS to 4.8.