Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling monotouch app using mdtool fails, works in MonoDevelop

I have a Monotouch iPad application for which I am trying to set up an automated build script. I am attempting to use mdtool, but I seem to have hit a wall. If I build the solution using the MonoDevelop GUI, it builds successfully. However, if I clean the solution, and build using mdtool, it get an exception about a null reference exception in an unknown file.

I've googled around for the last couple of hours. I thought I found a couple of leads here on Stack Overflow, but they all seem to be different situations. Not much out there about successful building in the UI and a failure on the CLI.

Here is some output:

     Performing main compilation...
        Updating CodeBehind files
ERROR [2011-06-03 11:27:52Z]: Error generating code for xib file '/Users/Me/Documents/Code/MyApp/MainWindow.xib'
System.NullReferenceException: Object reference not set to an instance of an object at MonoDevelop.DesignerSupport.CodeBehindWriter.<get_OpenFiles>m__21 () [0x00000] in <filename unknown>:0 
at MonoDevelop.Ide.DispatchService.GuiSyncDispatch (MonoDevelop.Ide.MessageHandler cb) [0x00000] in <filename unknown>:0 
at MonoDevelop.DesignerSupport.CodeBehindWriter.get_OpenFiles () [0x00000] in <filename unknown>:0 
at MonoDevelop.DesignerSupport.CodeBehindWriter.Write (System.CodeDom.CodeCompileUnit ccu, FilePath path) [0x00000] in <filename unknown>:0 
at MonoDevelop.MacDev.XibCodeBehind.GenerateDesignerCode (MonoDevelop.DesignerSupport.CodeBehindWriter writer, MonoDevelop.Projects.ProjectFile xibFile, MonoDevelop.Projects.ProjectFile designerFile) [0x00000] in <filename unknown>:0 
at MonoDevelop.MacDev.MacBuildUtilities.UpdateCodeBehind (IProgressMonitor monitor, MonoDevelop.MacDev.XibCodeBehind generator, IEnumerable`1 items) [0x00000] in <filename unknown>:0 

The command that I am executing looks like this:

/Applications/MonoDevelop.app/Contents/MacOS/mdtool -v build "--configuration:Release|iPhone" "/Users/Me/Documents/Code/MyApp/MyApp.sln" 

And just to keep it thorough, here are my versions:

    OS X: 10.6.7
    XCode: 3.2.6
    iOS SDK: 4.3
    Mono: 2.10.2
    MonoDevelop: 2.4.2
    MonoTouch: 4.0.3

Update (6/7/2011):

As an alternative, I tried doing mdtool generate-makefiles. It created everything one would expect, and ./configure ran properly, but make failed pretty miserably. I'd love to solve this problem if anyone has any thoughts.

like image 257
Kirk Avatar asked Jun 03 '11 16:06

Kirk


1 Answers

This is a bug, however designer code is generated only if the xib or the project (csproj) file is newer than the designer file. Build it once inside the IDE or "touch" the designer file and mdtool will work again.

like image 108
Mikayla Hutchinson Avatar answered Oct 13 '22 03:10

Mikayla Hutchinson