Using MEF with exporting project that uses resources (xml) contained in the xap.

Posted by JSmyth on Stack Overflow See other posts from Stack Overflow or by JSmyth
Published on 2010-03-08T21:10:03Z Indexed on 2010/03/08 21:21 UTC
Read the original article Hit count: 336

Filed under:
|

I'm doing a proof of concept app in SL4 using MEF and as part of the app I am importing another xap from an existing Silverlight Project and displaying it in my host project.

The problem is that the existing app uses some .xml files (as content) and it uses linq2xml to load these files which are (assumed to be) bundled in the xap.

When I compose the application the initalization fails because the host app doesn't contain the xml files. If I copy these xml files into the host project and run it the composition works fine. However, I need to keep the xml files in the original project.

Is there a way that I can download a xap and look at it's contents for xml files and then load them into the host xap at runtime so that after the compostion takes place the xml resources that are required can be found?

Or should I work out some kind of contract with an import/export to pass the xml files to the host xap?

As the people developing the imported xaps (should the project go ahead) are from a different company, I would like to keep changes to the way they develop their apps to a minimum.

© Stack Overflow or respective owner

Related posts about MEF

Related posts about silverlight-4.0