Aspose.Cells.dll using multiple versions


#1

We have a couple thousand applications developed that use version 3.7.1.0. Because the newer versions have changed the class name of Excel to Workbook, they would not be compatable. What is your recommended pratice to have multiple .dll files on a production server with applications using both version 3.7.1.0 and 4.0.2.0?


#2

Generally we don't suggest this practise. It's better to keep your old applications with v3.7.1 in one production server and put new applications with v4.0.2 in another server.

If you have to use v3.7.1 and v4.0.2 in one server, please build your new application with v4.0.2 and copy them to your server. Make sure that you don't replace any v3.7.1 dll with new v4.0.2 dll.


#3

Hi Laurence,

Thanks for your help on my other issues. And sorry for being such a pain in your butt.
I wanted to let you know that I found a better solution for supporting multiple versions of your assembly on my servers.

First, you have to create a delegate that responds to the ResolveAssemblyEventHandler Event

AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(ResolveAssemblyEventHandler);

Second, create the method that the delegate points to and return the correct assembly that you manually load from a file.

private static Assembly ResolveAssemblyEventHandler(object sender, ResolveEventArgs args)
{
// This solution was taken from:
// http://support.microsoft.com/default.aspx?scid=kb;EN-US;837908
// This handler is called only when the common language runtime tries to bind to the assembly and fails.

//Load the assembly from the specified path.
string strTempAssmbPath = @"E:\ICServer\AsposeCells.4.0.2.8\Aspose.Cells.dll";
FileInfo fiAspose = new FileInfo(strTempAssmbPath);
if (!fiAspose.Exists)
{
strTempAssmbPath = @"C:\ICdlls\AsposeCells.4.0.2.8\Aspose.Cells.dll";
}
Assembly MyAssembly = Assembly.LoadFrom(strTempAssmbPath);

//Return the loaded assembly.
return MyAssembly;
}

This works perfectly!