How to get all the assemblies information from the project

I want to create the instance of type that is present in another assembly by using reflection.can any body help me on how to create the instance that is present in another assembly....
mskeerthiAsked:
Who is Participating?
 
Gautham JanardhanConnect With a Mentor Commented:

Assembly assembly = Assembly.Load(System.IO.File.ReadAllBytes("FileName"));
            Type Type = assembly.GetType("MyType");
            object typeObject = Activator.CreateInstance(Type);

Open in new window

0
 
mskeerthiAuthor Commented:
when i am creating by using like this.in another project it is giving the error that

Error:Unable to cast object of type 'DfgClient.DfgService.InitDossierReq' to type 'DfgClient.DfgService.InitDossierReq'.

iam  doing the type casting like this:
 internal object InitDossier(object initrequest)
 {
             InitDossierReq request = (InitDossierReq)initrequest;
}

what can i do for this.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
Gautham JanardhanCommented:
the likely casue would be that ur assembly versions are  different..
0
 
mskeerthiAuthor Commented:
Excellent Solution for the problem
0
 
mskeerthiAuthor Commented:
I am trying to get the referenced assemblies by using reflection.but all my assembiles are not showing can anyone sent what will be reason ?
0
 
Gautham JanardhanCommented:
this will give u all the loaded assemblies

AppDomain.CurrentDomain.GetAssemblies();
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.