0 votes
by (120 points)

Good afternoon,

I am using Rebex Secure Mail since one year without problems.
Recently I upgraded to Rebex Total Pack and I am going to use Rebex FTP in place of previous FTP client.
I am programming with Microsoft Visual Basic 2010.
I dont want to upgrade all customers computers installing DLLs on GAC, so what I am tryng to do is to load DLLs at runtime from specific network directory ( in the same server where all programs are ).

For this, I have search on internet and found a way using AppDomain.CurrentDomain.AssemblyResolve and Reflection.Assembly.LoadFile(...) to load every single DLL.
I dont have problems with Rebex.Mail.dll and Rebex.Smtp.dll , they are loaded without problems.
I got error System.IO.FileNotFoundException with Rebex.Networking.dll.
I insert debug on program, and AssemblyResolve of Rebex.Networking is not called.

Any idea?

Thanks for your support

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (144k points)

This is most likely not a Rebex issue - it's actually quite tricky to get AppDomain.CurrentDomain.AssemblyResolve to work correctly. I can't tell exactly without access to your code, but I guess the following articles might be helpful:

However, may I ask why exactly are you doing this? Why don't you simply deploy the DLLs along with your application's executable? .NET does try looking up DLLs in GAC first, but it will look into your app's directory when it can't find the DLLS in the GAC. Most of our customers deploy DLLs with their application and don't need to use AssemblyResolve at all.

by (120 points)
My application, for now, is made by 150 single programs and is growing up day by day.
Rebex DLLs, Devexpress DLLs etc etc... I have already 70 MB of DLLs for each program, this mean around 10 GB just for duplicated DLLs ( and I have around 150 customers each one with some personal programs ).
My goal will be to have fast way to upgrade DLLs without need to reinstall everything on each customer PC and using AssemblyResolve looks the best way to do what I need.
by (144k points)
Thanks for sharing more details, this indeed looks like one of the cases where AssemblyResolve is useful. Was any of the articles actually helpful?
by (120 points)
I read articles, but my AssemblyResolve already was in that direction.
Im still searching for solution.
by (15.2k points)
Hi, I tried to reproduce the issue but with no luck. You can look to this sample project if you locate any difference with your approach. This project works for me with no issue.
by (120 points)
Debugging my program I understand that a lot of assemblies  are not included in the list I get using GetReferencedAssemblies. It seems that  compiler remove referenced assemblies not explicitily used in project.
I fixed my problems loading every assembly requested, without checking if referenced or not and without checking if it was loaded previously.