2010-12-27 12 views
1

Meine Lösung enthält 4 Silverlight-Projekte - ein Haupt-, zwei Modulprojekte und ein letztes Projekt (für allgemeine Schnittstellen usw.).Nicht behandelter Fehler in der Silverlight-Anwendung Das Modul kann nicht gefunden werden

Haupt- und Modulprojekte haben keine Referenzen zueinander (nur um Projekt zu teilen).

Sie können Definitionen meiner Module zu finden unter:

[ModuleExport("ServiceModule", typeof(ServiceModule), InitializationMode = InitializationMode.WhenAvailable)] 
public class ServiceModule : IModule 

[ModuleExport("ViewModule", 
    typeof(ViewModule), 
    DependsOnModuleNames = new string[] { "ServiceModule" }, 
    InitializationMode = InitializationMode.WhenAvailable)] 
public class ViewModule : IModule 

Und ich hinzugefügt Module in abgeleitet MefBootstrapper Klasse von Hauptprojekt ModuleCatalog (I verwendete Code Registrierung von Modulen statt CreateFromXaml-Methode):

protected override void ConfigureModuleCatalog() 
{ 
    ModuleCatalog.AddModule(
     new ModuleInfo() 
     { 
      ModuleName = "ServiceModule", 
      ModuleType = "SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea", 
      Ref = "SilverlightEnabledService.xap", 
      InitializationMode = InitializationMode.WhenAvailable 
     } 
    ); 

    ModuleCatalog.AddModule(
     new ModuleInfo() 
     { 
      ModuleName = "ViewModule", 
      ModuleType = "RedOrBlackModule.ModuleDefinitions.ViewModule, RedOrBlackModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea", 
      Ref = "RedOrBlackModule.xap", 
      InitializationMode = InitializationMode.WhenAvailable, 
      DependsOn = (new Collection<string>(new string[] { "ServiceModule" })) 
     } 
    ); 
} 

wie sehen von Code oben, ModuleCtalog Modulname der gleiche wie Modulname in ModuleExportAttribute ist, aber ich bekomme Ausnahme unter:

Uncaught Error: Unhandled Error in Silverlight Application Unable to locate the module with type 'SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea' among the exported modules. Make sure the module name in the module catalog matches that specified on ModuleExportAttribute for the module type. в Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)...

Es scheint sehr einfach Problem, aber ich kann noch keine Lösung finden.

Antwort

0

Es gibt mehrere Gründe, warum das Modul möglicherweise nicht gefunden wird. In diesem Blogpost erhalten Sie einen Überblick über die Funktionen und deren Debugging: How to Debug and Diagnose MEF Failures.

+0

Vielen Dank. Es hat mir nicht geholfen (ich habe diesen Link schon einmal gefunden). Wie auch immer, ich denke, deine Antwort wird Single sein;) Ich werde versuchen, die Lösung Schritt für Schritt zu finden. –