Thursday, October 25, 2012

Mono CSC.exe and HASH_SET error

I fought this error until I found the magic incantation that would work on google. It's a known bug with the 2.6.x mono release.
C:\PROGRA~2\MONO-2~1.7\lib\mono\3.5\Microsoft.CSharp.targets: error : 
Error executing tool 'C:\PROGRA~2\MONO-2~1.7\bin\gmcs': 
ApplicationName='C:\PROGRA~2\MONO-2~1.7\bin\gmcs', CommandLine='/noconfig @C:\Temp\tm
p46ea550.tmp', CurrentDirectory='c:\working\ITAEngine\ITAEngine'
        Task "Csc" execution -- FAILED
        Done building target "CoreCompile" in project "c:\working\working.csproj".-- FAILED
The fix is to add /p:CscToolExe=gmcs.bat to the xbuild command line.
c:\working>xbuild /p:Configuration=Release /p:CscToolExe=gmcs.bat working.csproj
Another problem is the HASH_SET wasn't being detected which requires a new Reference. in the ItemGroup The error:
FileManager.cs(17,25): error CS0246: The type or namespace name `HashSet`1' could not be found. Are you missing a using directive or an assembly reference?
        Task "Csc" execution -- FAILED
        Done building target "CoreCompile" in project "c:\working\working.csproj".-- FAILED

The fix to include in the csproj is:

<Reference Include="System.Core" />

No comments: