ViewSwitchingNavigation Sample Error

Topics: Prism v4 - Silverlight 4
Mar 20, 2011 at 10:30 PM

I am keen to get started with Prism but cannot even get the View-Switching Navigation example to work!

I am using VS2010 and Silverlight V4.

When I open the solution the System.Windows.Controls references are marked with a warning triangle and there is no path to the assembly and I cannot build the solution. I have no problems with this assembly in solutions such as the standard Silverlight Business Application template and the assembly exists in 'C:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client'.

If I remove this reference and re-add it the solution builds but I get the following error: -

System.Reflection.ReflectionTypeLoadException was unhandled by user code
  Message=Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  StackTrace:
       at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
       at System.Reflection.RuntimeModule.GetTypes()
       at System.Reflection.Assembly.GetTypes()
       at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
       at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_Parts()
       at Microsoft.Practices.Prism.MefExtensions.DefaultPrismServiceRegistrar.GetRequiredPrismPartsToRegister(AggregateCatalog aggregateCatalog)
       at Microsoft.Practices.Prism.MefExtensions.DefaultPrismServiceRegistrar.RegisterRequiredPrismServicesIfMissing(AggregateCatalog aggregateCatalog)
       at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.RegisterDefaultTypesIfMissing()
       at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.Run(Boolean runWithDefaultConfiguration)
       at ViewSwitchingNavigation.App.Application_Startup(Object sender, StartupEventArgs e)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
  InnerException:

I have made no changes to the solution at all.

The MVVM Quckstart example builds and runs OK, however this also has the error warning triangle on the System.Windows.Controls reference and there is no entry in the path property.

Help would be greatly appreciated.

Mar 21, 2011 at 3:03 PM

Hi,

We’ve tried to reproduce the situation you’ve mentioned, but in our working environments it works ok.

You could try repairing the .NET v4.0 framework and re install the Silverlight Tools for Visual Studio in order to make sure your required assemblies are correctly registered. You could also check the list of prerequisites for Prism to work, so as to make sure that you have all of them installed:

  • Microsoft Visual Studio 2010 Professional, Premium, or Ultimate edition
  • Microsoft .NET Framework v4.0 (installed with Visual Studio 2010)
  • Silverlight Tools for Visual Studio 2010 (required for Silverlight development; includes the developer Silverlight runtime)
  • Optional tools:
    • Expression Blend 4
    • Windows Phone Developer Tools SDK (for development with the Windows Phone 7)

Please let us know if this information helps you.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Mar 21, 2011 at 10:35 PM
Edited Mar 21, 2011 at 10:35 PM

Thanks for your reply.

I have the prerequisites OK.

This is the first problem I have had with VS2010/Silverlight however when I tried it in on my PC at work it ran fine so, as you suggest, there must be something corrupted about my installations which I will redo.