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

  • Home
  • SEARCH
  • 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 3440944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:29:33+00:00 2026-05-18T08:29:33+00:00

Basically the problem is that I’d like to invoke a method in an unreferenced

  • 0

Basically the problem is that I’d like to invoke a method in an unreferenced assembly, but can’t seem to find the right call for instantiating the class. I’ve tried things like a simple Type t = Type.GetType("MyApp.Helper") which returns null, and Assembly.LoadFrom("MyApp.Helper") which throws a security exception.

In the example below, two projects/assemblies (Helper.dll and Menu.dll) are compiled separately into a common ‘libs’ folder, but do not reference each other. Main.dll references both, and the references are set to ‘Copy local’ in VS. So when the app runs, the Main.xap should contain all three assemblies and they should be loaded into the same application domain. Or so goes my understanding. Is this an impossible quest? I see lots of comments regarding plug-ins but so far I haven’t seen examples for this specific design. For example, I suppose I could do something like Jeff Prosise describes here, but I’d rather have everything in one package.

Here’s a sketch of my code:

In one project/assembly, I have a worker class:

namespace MyApp.Helper {  
    public class Helper {  
        public void ShowHelp() {  
            Console.Write("Help!");  
        }  
    }  
}  

In another project/assembly, I have a menu class which tries to invoke the helper:

namespace MyApp.Menu {
    public class Selector {
        public void InvokeSelection(string className, string functionName) {

            // fails: t will be null
            Type t = Type.GetType(className);  

            // fails: t will be null
            t = Type.GetType(string.Format("{0}.{1}, {0}, Version=1.0.0.0, Culture=\"\", PublicTokenKey=null", "MyApp.Helper", "Helper"));

            // however, this works (reference to main assembly?)
            t = Type.GetType(string.Format("{0}.{1}, {0}, Version=1.0.0.0, Culture=\"\", PublicTokenKey=null", "MyApp.Main", "Worker"));

            // and, I'd like to do something like the following
            // t.InvokeMember(functionName, ...);
        }
    }
}

Finally, I have the main app assembly:

namespace MyApp.Main {
    public class Main {
        public static void Main() {
            MyApp.Menu.Selector sel = new Menu.Selector();
            sel.InvokeSelection("MyApp.Help.Helper", "ShowHelp");  // fails
            sel.InvokeSelection("MyApp.Main.Main", "Worker"); // works in some cases
        }
        public void Worker() {
            Console.Write("Work!");
        }
    }
}

Thanks for any ideas!

-Chris.

  • 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-05-18T08:29:34+00:00Added an answer on May 18, 2026 at 8:29 am

    You need to get the Assembly object, then call its GetType method.

    However, I don’t see why you’re using Reflection at all.
    You can call the method normally from your main project.

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

Sidebar

Related Questions

Basically like using the out keyword. But the problem is with the out keyword,
Basically the problem is that each time the assembly version changes (i.e. the user
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
I'm currently working on a problem that basically involves processing all data in a
Basically my problem is a that I need to copy an uploaded file (which
basically the problem is, that the only way to get all instances of VLC
Basically I have a problem that is pretty much embrassing parallel and I think
I am trying to solve a problem that involves basically implementing a logical AND
Basically the problem is that I'm starting doing somme development of Visual Studio 2010
Basically my problem stems from a desire to have the textbox portion be white,

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.