473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Type.GetType - can you get the type of an assembly located in a subdirectory?

I'm working on adding plugin capability to my application and would like
to do it something like this:

System.Type myType = System.Type.GetType( "namespace.classname,
assembly_name" );
object pluginObject = System.Activator.CreateInstance( myType );

this works perfectly fine if the assembly_name.dll file is in the same
directory as the executable, however when I try to move the dll to
\plugins myType ends up being null. I've tried the following different
strings inside of GetType and none have worked:
@"namespace.classname, plugins\assembly_name"
"namespace.classname, plugins\\assembly_name"
@"namespace.classname, plugins/assembly_name"
@"namespace.classname, plugins.assembly_name"

Is it just not possible to get an assembly type outside of the current
folder?

~Benny
Nov 17 '05 #1
1 2410
Benny ....
You can do:
AppDomain.CurrentDomain.AppendPrivatePath("plugins ");

http://www.geocities.com/jeff_louie/OOP/oop13.htm

or I suspect use Assembly.LoadFrom

C# 2.0 supports loading a plug in into a low trust domain.

Regards,
Jeff
Is it just not possible to get an assembly type outside of the current

folder?<

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Neo | last post by:
Does anyone know how to get a list of the types in an Assembly without actually loading the Assembly into your app domain?
1
by: Jean Stax | last post by:
Hi ! I created a sample library project. In my second project I reference this library and make the following call, which returns "undefined value": Type myType =...
1
by: hazz | last post by:
"Value cannot be null.\r\nParameter name: type" is the exception thrown after the CreateInstance method below. Type t = Type.GetType(GetConfigValue("PasswordProvider")); IPasswordProvider ppdr=...
1
by: Chriss | last post by:
I receive "could not load type" error message when trying to load aspx page. The DLL is built and is located in the correct bin directory. The type name in the "inherits" attribute matches the...
1
by: Dominique Vandensteen | last post by:
I want to dynamicly load a type (typename is defined in the database). This type is located in the exe itself or one of the dll's in the directory with the exe file. When creating an instance...
7
by: Allan Ebdrup | last post by:
How do I get hold of the type when I have a string that represents the type. For example I have the string "OFiR.Recruitment.Department" And I want to get the type called...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
1
by: Dan Holmes | last post by:
Is there any way to create an instance of type Type when all that is known is the FullName of the type? I was trying Type.GetType but that requires an AssemblyQualifiedName. I don't have the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.