binding to an unsigned assembly outside the appbase

  • Thread starter Thread starter janekw
  • Start date Start date
J

janekw

....is this possible? Can you perchance provide an entry in the config
file which would allow such behaviour?

I think it should be possible at least on the local machine, you can
always copy those unsigned assemblies to a subfolder of your app, so
it's not like it's a security feat.

Thanks for any help,
Jan
 
It's a bit wierd anyhow. I've loaded an assembly into my domain using
LoadFrom() function; then when I want to deserialize an object of a
class from this assembly, I get those binding errors. Isn't the
required assembly already loaded? Why bind, then? The only option I
know of is to copy the assembly file somewhere into appbase. Isn't
there another way (apart from singing the assembly)

Jan
 
Hello, janekw!

j> I think it should be possible at least on the local machine, you can
j> always copy those unsigned assemblies to a subfolder of your app, so
j> it's not like it's a security feat.

You can provide codebase path, where loader can find assemblies.
( http://msdn2.microsoft.com/en-us/library/efs781xb.aspx )

For more details on how Runtime loads and binds assemblies look at
( http://msdn2.microsoft.com/en-us/library/yx7xezcf.aspx )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Hello, Vadym
You can provide codebase path, where loader can find assemblies.
( http://msdn2.microsoft.com/en-us/library/efs781xb.aspx )

First of all it's no use to me because I'd have to know the identity of
each of those libraries in advance, i.e. before runtime, and I know
only a folder name. But you couldn't have known that, of course:)
Anyway, "codebase" won't work with unsigned assemblies outside the
appbase - either you sign the assembly or copy it somewhere below your
app's root folder.

Thanks for reply,
Jan
 
Hello, janekw!

j> First of all it's no use to me because I'd have to know the identity of
j> each of those libraries in advance, i.e. before runtime, and I know
j> only a folder name. But you couldn't have known that, of course:)
j> Anyway, "codebase" won't work with unsigned assemblies outside the
j> appbase - either you sign the assembly or copy it somewhere below your
j> app's root folder.

Why? If you know assembly names, with the help of config settings
you can do the redirection. Or I'm missing something here?

Or if you do not know their names then you can use Assembly.LoadFile(...) to load assemblies.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Vadym said:
Why? If you know assembly names, with the help of config settings
you can do the redirection. Or I'm missing something here?

I don't know their names, but even if I knew, I'd have to sign all of
them to do the redirection, because they are located outside my app's
root folder. Too much trouble.
Or if you do not know their names then you can use Assembly.LoadFile(...) to load assemblies.

Exactly. I load them at startup using this function. But it's not
enough for automatic deserialization. I've mentioned it in my second
post but let me be more specific:

Let's say those assemblies contains definitions of serializable classes
B, C, D and all of them derive from (also serializable) class A , which
I know and I have it's assembly "statically" linked to my project. At
runtime, after I LoadFile() B, C, D, I can dynamically (i.e. by
reflection) create these instances. I can also serialize the objects.
But in turn when I want to deserialize them, I get binding errors to
assemblies with B, C, D.

So, you know the situation. I can copy those assmeblies into a
subfolder on my app, so it's not a critical problem. I just wonder if
you can solve this in more elegant fashion:)

Jan
 
Back
Top