Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create an instance from assembly in the GAC...

Status
Not open for further replies.

Programmer76

Programmer
Jul 25, 2006
35
CA
Hi,

I am having a difficult time with referencing a dll in the GAC. I have signed and deployed the dll to the GAC and I can see it in there.

What I would like to do is create and instance of the class that is inside the dll.

During developing I have just had a refernce to the dll in my project and I was using the following code to create an instance

Code:
Type t = Type.GetType("MyNamespace.MyClass");
IMyClass a = (IMyClass)Activator.CreateInstance(t);

This worked fine...

How do I create an instance of an object that is in the GAC...I have seen many examples but nothing seems to work...

Any suggestions?
 
You shouldn't need the Activator class -- once you've added the reference to your project (and optionally included the namespace in your source file with the using keyword), all you should need is the new keyword to instantiate it.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top