NO XAML was found at location ....

Topics: Prism v4 - Silverlight 4
Aug 9, 2011 at 9:53 PM

Hello all,

I am using SL 4, Prism v4, VS 2010.  

in my bootstrapper, I am must be able to load the module catalog from XAML since i want to be able to deploy my XAP independently.  

in CreateModuleCatalog method in my bootstrapper I have

var moduleCatalog = Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri("/Canoe.Studio.Client;component/ModulesCatalog.xaml"UriKind.Relative));
return moduleCatalog;
It load fine, since i have the "module" in the collection of module catalog.  
My ModulesCatalog looks like 
<prism:ModuleInfoGroup Ref="Canoe.Studio.Modules.Main.xap" InitializationMode="WhenAvailable">
	<prism:ModuleInfo ModuleName="MainModule" ModuleType="Canoe.Studio.Modules.Main.MainModule, Canoe.Studio.Modules.Main, Version=1.0.0.0"/>
</prism:ModuleInfoGroup>
My module Assembly Name = Canoe.Studio.Modules.Main and my namespace is Canoe.Studio.Modules.Main, my class that implements IModule is called MainModule.

whenever i try to run this application I get 'No XAML was found at the location '/Canoe.Studio.Modules.Main;component/ViewPages/HomePage.xaml'.

But I have a folder named ViewPages, and a page called HomePage.xaml..

Any suggestions?



Aug 9, 2011 at 10:42 PM

Hmm I think you need

<prism:ModuleInfoGroup Ref="Canoe.Studio.Modules.Main.xap" InitializationMode="WhenAvailable">
	<prism:ModuleInfo ModuleName="MainModule" ModuleType="Canoe.Studio.Modules.Main.MainModule, Canoe.Studio.Modules.Main, Version=1.0.0.0, PublicToken=null" 
Ref="Conoe.Studio.Modules.Main.xap" />
</prism:ModuleInfoGroup>
Aug 9, 2011 at 10:45 PM

Thank you for your quick response, but that did not do it.

Thanks Houmie

Aug 10, 2011 at 4:01 PM

Anyone has any other suggestion?  

Prism Team any suggestions?

Developer
Aug 10, 2011 at 7:51 PM
Edited Aug 10, 2011 at 9:30 PM

Hi,

So far, we couldn’t find anything wrong within the code snippets that you posted.

It would be helpful if you could provide us with a repro sample application that portrays this problem, so we can help you find the causes behind it.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Aug 10, 2011 at 7:55 PM
is it best to email it to you or how should I post it?
From: [email removed]
Sent: Wednesday, August 10, 2011 12:51 PM
To: [email removed]
Subject: Re: NO XAML was found at location .... [CompositeWPF:268440]

From: DCherubini

Hi,

Sorry for the delay,

So far, we couldn’t find anything wrong within the code snippets that you posted.

It would be helpful if you could provide us with a repro sample application that portrays this problem, so we can help you find the causes behind it.

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Aug 10, 2011 at 8:04 PM

Hello,

Please take download this solution https://skydrive.live.com/?cid=a90175fbc3e78b6b&sc=documents&id=A90175FBC3E78B6B%21311

Let me know if you need anything else.

 

Aug 10, 2011 at 9:56 PM

Where you able to get the solution.   Because I would like to remove it from SkyDrive.

Developer
Aug 11, 2011 at 3:21 PM

Hi,

We have downloaded your solution, so you can remove it from SkyDrive. We will examine it and provide an answer to you soon.

Thanks,

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Developer
Aug 12, 2011 at 3:03 PM

Hi,

We examined your solution and found that the problem is probably caused by the fact that you're trying to use uri mapping to access your view; however, the project where this view is located (Canoe.Studio.Modules.Main) is not referenced from the shell project (Canoe.Studio.Client), thus causing the error.

Since adding a reference to the module from the shell project would break the benefits of Prism modularity (as you've mentioned), that isn't an option. Therefore, you could follow the approach described in the following blog posts by Karl Shifflett, which describe how to integrate Prism Region Navigation with Silverlight Navigation:

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Aug 12, 2011 at 3:50 PM

so if I add Module.Main to the Client, does that mean we have to add the other modules as well?

Aug 12, 2011 at 3:58 PM

if I remove the URI Mapping and add them something similar to

 

 <navigation:Frame.UriMapper>
                    <uriMapper:UriMapper>
                        
                        <!--Default applicaiton mapper-->
                        <uriMapper:UriMapping Uri="" MappedUri="/ThePhoneCompany.Views.HomeView"/>
                       
                        <!--Used to add a new record-->
                        <uriMapper:UriMapping Uri="/{moduleName}/{pageName}/add" MappedUri="ThePhoneCompany.{moduleName}.Views.{pageName}?key=0"/>
                        
                        <!--Used to edit a record-->
                        <uriMapper:UriMapping Uri="/{moduleName}/{pageName}/{key}" MappedUri="ThePhoneCompany.{moduleName}.Views.{pageName}?key={key}"/>
 
                        <!--Used to view a page-->
                        <uriMapper:UriMapping Uri="/{moduleName}/{pageName}" MappedUri="ThePhoneCompany.{moduleName}.Views.{pageName}"/>
                        
                        <!--Used to navigate to a page in the Shell-->
                        <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/ThePhoneCompany.Views.{pageName}"/>
 
                    </uriMapper:UriMapper>
                </navigation:Frame.UriMapper>

would that solve it?
Developer
Aug 12, 2011 at 4:08 PM

Hi,

Adding references to the modules from the shell and accessing the types of the module from the shell isn't a recommended approach, and is not guaranteed to work with your uri mapping scenario.

As for the approach you're describing in your second post, you not only need to modify the uri mapping scheme, but also include the other components explained in Karl Shifflett's blog post, so that a change in the uri is mapped to region navigation operations.

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi