Thanks for this post. I got your example to work using IE but when I try it with Firefox it throws a System.IO.FileNotFoundException.
I did some research and it looks like the Firefox cache is structured differently than IE's because IE's is just a folder containing the cached files whereas Firefox's cache has the cached files embedded in other non-recognizable file names. So I'm assuming
that the Assembly.Load() function is actually looking at the client's local file structure trying to find the file [assemblyName].dll. It can find it in IE but not in Firefox.
Therefore it seems to me that the only way this can be accomplished across browsers is to download the .dll and .xaml files separately and then call XamlReader.Load() on the downloaded .xaml file. Then somehow Silverlight seems to find the associated .dll
both in IE and Firefox. I haven't tested it in Safari but I'm assuming it works fine.
The only downside to this approach is that you have to download two files; I was hoping to be able to embed the .xaml file in the .dll and then call XamlReader.Load() from a static method within the .dll, which would be nice because you only need one download.
However, I could see that depending on the application, it may be beneficial to download the .xaml and .dll files separately if the .xaml files are huge.
Please let me know if there's a better way of accomplishing this goal.
bobk333
Member
4 Points
2 Posts
Re: Late loading/binding?
Jul 07, 2007 01:33 AM | LINK
Jamie,
Thanks for this post. I got your example to work using IE but when I try it with Firefox it throws a System.IO.FileNotFoundException.
I did some research and it looks like the Firefox cache is structured differently than IE's because IE's is just a folder containing the cached files whereas Firefox's cache has the cached files embedded in other non-recognizable file names. So I'm assuming that the Assembly.Load() function is actually looking at the client's local file structure trying to find the file [assemblyName].dll. It can find it in IE but not in Firefox.
Therefore it seems to me that the only way this can be accomplished across browsers is to download the .dll and .xaml files separately and then call XamlReader.Load() on the downloaded .xaml file. Then somehow Silverlight seems to find the associated .dll both in IE and Firefox. I haven't tested it in Safari but I'm assuming it works fine.
The only downside to this approach is that you have to download two files; I was hoping to be able to embed the .xaml file in the .dll and then call XamlReader.Load() from a static method within the .dll, which would be nice because you only need one download. However, I could see that depending on the application, it may be beneficial to download the .xaml and .dll files separately if the .xaml files are huge.
Please let me know if there's a better way of accomplishing this goal.
Thanks,
Bob