How to resolve “Could not load file or assembly 'Microsoft.Practices.Prism' ” error?

前端 未结 7 1157
梦谈多话
梦谈多话 2021-01-16 03:16

I\'ve been searching the past few days trying to get an error fixed in a WPF application using Prism, but haven\'t had any luck and thought I\'d see if Stackoverflow had any

相关标签:
7条回答
  • 2021-01-16 03:40

    Add reference Microsoft.Practices.ServiceLocation to your Test Project to resolve this issue.

    0 讨论(0)
  • 2021-01-16 03:42

    I had the same exception (Prism 5.0) and my solution was to set the type of the config section to Microsoft.Practices.Prism.Composition instead of Microsoft.Practices.Prism which I found in many examples.

    0 讨论(0)
  • 2021-01-16 03:47

    The solution ended up being simple, as these things often are... I hadn't changed my App.config file's Build Action to "Resource" (can be found by clicking on the App.config file and looking at the properties section).

    0 讨论(0)
  • 2021-01-16 03:48

    I've encountered similar issue last time. My solution was different and very specific but error was same. If you are sending you binaries and target PC uses Windows 10 make sure that you unblock all files.

    0 讨论(0)
  • 2021-01-16 03:49

    StackTrace: at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at Microsoft.Practices.Prism.Modularity.ConfigurationStore.RetrieveModuleConfigurationSection() at

    The call stack itself indicates that Prism is already loaded, but when it tries to parse the .config file, an exception happens in RetrieveModuleConfigurationSection.

    You might start from there to check what might be the cause.

    0 讨论(0)
  • 2021-01-16 03:51

    In the newer versions of Prism (I'm using 6.3.0), the ModulesConfigurationSection class is in Prism.Wpf.dll.

    Change your configuration to this:

    <configSections>
        <section name="modules" type="Prism.Modularity.ModulesConfigurationSection, Prism.Wpf"/> 
    </configSections>
    
    0 讨论(0)
提交回复
热议问题