Solved

How to get all the assemblies information from the project

Posted on 2008-06-23
7
649 Views
Last Modified: 2010-04-21
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....
0
Comment
Question by:mskeerthi
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:elimesika
ID: 21844220
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 21844340

Assembly assembly = Assembly.Load(System.IO.File.ReadAllBytes("FileName"));

            Type Type = assembly.GetType("MyType");

            object typeObject = Activator.CreateInstance(Type);

Open in new window

0
 

Author Comment

by:mskeerthi
ID: 21844408
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21844430
the likely casue would be that ur assembly versions are  different..
0
 

Author Closing Comment

by:mskeerthi
ID: 31469648
Excellent Solution for the problem
0
 

Author Comment

by:mskeerthi
ID: 21844613
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
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21844625
this will give u all the loaded assemblies

AppDomain.CurrentDomain.GetAssemblies();
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Latency in .net app using DB in .net 21 34
Need to pass stored proc parameters in list 13 33
Capture logon name 13 46
Automated testing suggestions? 2 28
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now