[Mono-osx] NIB files in non-executable assemby problem

Chris Hamons chris.hamons at ni.com
Mon Feb 13 21:00:14 UTC 2012

I already had that in my window controller.

As a side note, I built a functionally similar example using MonoTouch and 
it works fine (it doesn't need the main executable to reference the nib 
file). Should I create an example app to show the problem?


From:   Virginijus <mrgutis at gmail.com>
To:     Chris Hamons <chris.hamons at ni.com>
Cc:     mono-osx at lists.ximian.com
Date:   02/09/2012 02:12 PM
Subject:        Re: [Mono-osx] NIB files in non-executable assemby problem

Make sure your windowcontroller has:

//strongly typed window accessor
public new <WindowClass> Window {
get { return (<WindowClass>)base.Window; }

On Thu, Feb 9, 2012 at 7:32 PM, Chris Hamons <chris.hamons at ni.com> wrote:
I'm working with monomac and am trying to port some code. I'm unsure if 
this is a problem with my code, with my project build settings, or an 
actual bug. Any help would be appreciated: 

I have two assemblies of interest, one setup as a Library and the other as 
an Executable (that depends on the Library). The code in question is 

Executable Assembly: 

        static void Main (string [] args) 

Library Assembly: 

        public static void Run() 
                NSApplication.Init (); 
                NSApplication.Main(new string[] {}); 
            catch (Exception exception) 

       public override void FinishedLaunching (NSObject notification) 
             mainWindowController = new MyController(); 

        // Call to load from the XIB/NIB file 
        public MyController() : base ("MyController") 
            Initialize (); 

The Library Assembly also contains MyController.xib. 

If I run the project as listed, mainWindowController.Window is null (and 
thus I crash) and in some conditions I get a print to Application Output 
about difficulty finding the xib file. 

If I add a reference to MyController.xib in my executable assembly then I 
see my window just fine. 

Is there any way I can make this work without having to add this 
reference? I've tried changing the build setting in MyController.xib in 
the Library assembly to no effect. 

If my example is unclear, I can create a simple project that shows this if 

Mono-osx mailing list
Mono-osx at lists.ximian.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-osx/attachments/20120213/e5049bc7/attachment.html>

More information about the Mono-osx mailing list