Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:44:24+00:00 2026-06-05T22:44:24+00:00

I have a WPF Desktop application using Prism 4, in my bootstrapper i have

  • 0

I have a WPF Desktop application using Prism 4, in my bootstrapper i have the following code :

protected override IModuleCatalog CreateModuleCatalog()
{
   var filepath = Assembly.GetExecutingAssembly().Location;
   var path = Path.GetDirectoryName(filepath);
   System.IO.Directory.SetCurrentDirectory(path);
   path = Path.Combine(path, "Modules");
   var moduleCatalog = new DirectoryModuleCatalog() { ModulePath = path };
   return moduleCatalog;
}

the above code is telling prism to load all the .dlls from “[my app root]\Modules” path and check them to see if any class has implemented IModule. What I want to do is to limit the loading process to only DLLs which have been signed with a specific sign key so that prevent any developer to inject it’s module in my application. please advice if I’m following the wrong path for such issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:44:25+00:00Added an answer on June 5, 2026 at 10:44 pm

    You are on the right path, however, you need to go a little further. The DirectoryModuleCatalog is designed to load any types in the specified directory that implement the IModule interface, as you have seen. If you want to limit the modules that are loaded further (for example, to assemblies signed with a specific key), you need to create a custom module catalog (likely derived from DirectoryModuleCatalog), and override the Initialize method. Initialize is where the module catalog will examine the directory and load a collection of ModuleInfo objects that contain the information about any modules in the directory. By overriding this method, you can examine the assemblies in the directory and only load modules from assemblies with the proper signature. In the Initialize method, you would populate the Modules property with ModuleInfos of Modules contained in valid assemblies.

    Then, in the above code, rather than creating a new DirectoryModuleCatalog(), you would create your custom module catalog.

    Please note, depending on how you check the signature of the assembly, you may be loading the assembly into memory (even if you don’t make any modules available in the catalog). If this is the case, you may want to verify the assemblies in a separate AppDomain which can then be unloaded (therefore unloading the unsigned assemblies from memory).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have created a beautifully designed .NET WPF desktop application. We are installing the
I have a desktop .NET WPF application witch uses an embedded database (SQLite). Where
We have a WPF Application that runs from both desktop and as a XBAP
So, I have this desktop app built using WPF and C#. It's basically an
I'm working with WPF and EF 4.2 to build a desktop application. I have
Environment: Visual Studio Ultimate 2010 Windows XP WPF Desktop Application using .NET 4.0 We
I'm writing a WPF desktop application and have a view that needs to look
I have worked on a desktop application which I have created using the combination
Background/context for this question: I have a WPF desktop application. It uses LINQ to
I have a WPF desktop application ( .NET 4.0 ) that is talking to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.