From: BlackSun on
Hi,
I would like to know if is possible to reference a DLL placing on a
network but without to copy the DLL into the bin folder?

Thank you very much!

Cheers,
BlackSun
From: Family Tree Mike on
On 3/25/2010 9:48 AM, BlackSun wrote:
> Hi,
> I would like to know if is possible to reference a DLL placing on a
> network but without to copy the DLL into the bin folder?
>
> Thank you very much!
>
> Cheers,
> BlackSun

I believe the only way you could do this is via Assembly.Load() and
similarly named approaches, and using reflection to instantiate classes.

I've got to ask, what is the perceived benefit to you by forcing this
requirement?

--
Mike
From: Tom Shelton on
On 2010-03-25, BlackSun <black_sun(a)email.it> wrote:
> Hi,
> I would like to know if is possible to reference a DLL placing on a
> network but without to copy the DLL into the bin folder?
>
> Thank you very much!
>
> Cheers,
> BlackSun

Well, as long as you can read the dll, then sure. I have some dynamic
validation dlls that I load from the db. The idea is basically, read the dll
file into a byte array and then call assembly.load with the byte array.

So, I would do something like this for a dll...

Dim dllData() As Byte = File.ReadAllBytes("pathtodll")
Dim dllAssembly As Assembly = Assembly.Load (dllData)

once you have that assembly reference, you can laod types out of it etc. for
instance, I have a dll that defines common interfaces/base classes that are
referenced by the individual validator dlls and the parent assembly - that way
there is a known means of communication (Air-Code)...

Dim validator As FAValidatorBase = TryCast (dllAssembly.CreateInstance (validatorInfo.ClassName), FAValidatorBase)
If validator Is Nothing Then Throw New FAValidatorLoadException(validatorInfo.ClassName)

Dim validationResults As FAValidationResults = validator.PerformValidation(inputData)

So, the question is do you have access to the dll's data and can you read it
into a byte array :)

--
Tom Shelton