0 votes
by (190 points)

Hello,

just downloaded the Trial of your Secure Mail component and want do use it from another software (ZennoPoster, an webautomation framework in C#). The problem is, when I try to add the reference to e.g. your Rebex.Networking.dll or Rebex.Smtp.dll I get the following error:

""Connection assembly to project"
Message: "System.ApplicationException: Could not load exported type data for assembly 'Rebex.Networking, Version=3.0.6249.0, Culture=neutral, PublicKeyToken=1c4638788972655d'. ---> System.IO.FileLoadException: Could not load file or assembly 'Rebex.Common, Version=2.0.6249.0, Culture=neutral, PublicKeyToken=1c4638788972655d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at #Rye.#eze..ctor(Assembly assembly, String assemblyFullName, String assemblyLocation, String cachePath, Boolean documentationEnabled)
--- End of inner exception stack trace ---
at #Rye.#eze..ctor(Assembly assembly, String assemblyFullName, String assemblyLocation, String cachePath, Boolean documentationEnabled)"

Referencing other .dlls e.g. Rebex.Common.dll or Rebex.Mail.dll works fine. Also when I add the .dlls to a VS2008 project all of them are working and I even tested to send out an email with SMTP via SSH and the email arrives at the recipient.

Would be great if you can help me out with this error.

Thank you!
Best,
Martin

Applies to: Rebex Secure Mail

1 Answer

+1 vote
by (148k points)

Hello,

It looks like the ZennoPoster application itself uses Rebex FTP/SSL and comes with the following DLLs:

c:\Program Files (x86)\ZennoLab\ZennoPoster Demo\Progs>dir Rebex*
 Volume in drive C is OS
 Volume Serial Number is 6E49-0CC1

 Directory of c:\Program Files (x86)\ZennoLab\ZennoPoster Demo\Progs

2017-03-03  10:13 AM           333,672 Rebex.Common.dll
2017-03-03  10:13 AM           325,480 Rebex.Ftp.dll
2017-03-03  10:13 AM           333,672 Rebex.Networking.dll
2017-03-03  10:13 AM           259,944 Rebex.Sftp.dll
               4 File(s)      1,252,768 bytes

These DLLs come from Rebex FTP/SSL 2012 R3, which includes "Rebex.Common, Version=2.0.4700.0, Culture=neutral, PublicKeyToken=1c4638788972655d" and "Rebex.Networking, Version=3.0.4700.0, Culture=neutral, PublicKeyToken=1c4638788972655d".

This is most likely the cause of the issue - your plugin is looking for a new version of Rebex assemblies, but this fails because ZennoPoster already loaded an older version of the assembly.

Possible solutions:

a) Install the new version of Rebex assemblies into GAC. The resolver might be able to find them there.

b) Revert to Rebex Secure Mail 2012 R3 for your plugin. However, please be aware that this is strongly discouraged. The 4-year-old version of Rebex Secure Mail is outdated and insecure - it doesn't support TLS 1.2 and it's susceptible to Logjam attacks.

c) Modify ZennoPoster to make it possible for plugin authors to reference whatever assemblies they want. Possibly by loading plugins into separate AppDomain, or by using AppDomain.AssemblyResolve event. I won't get into details because this would have to be done by ZennoPoster vendor, but see this article for more information.

by (190 points)
Hello Lukas,

Thank you very much for your quick response and the time and effort you spent in analyzing and explaining the problem. I will try to add the latest Secure Mail assemblies into the GAC und hope this will work. Also I forward this thread to the ZennoPoster developers so they can maybe update the used libraries or implement your point c.

Best,
Martin
...