Posted 8 April 2018, 11:38 pm EST
Hi,
I’m using C1Datagrid for my application. The current version i use is C1.WPF.4, Version=4.0.20173.580.
I work on an project where i extend an existing application via C#-Addins. The existing application is called “Eplan Electric P8”. When i start the application the .NET Runtime creates an AppDomain. The base directory is located in “E:\EplanP8\Platform\Bin”.
My Addins are located in “E:\Eplan P8\Custom Addins”.
When i start the software and call my addin with the UI using the c1Datagrid, i always get an error that the DLL “C1.WPF.DataGrid.Filters.4.dll” and “C1.WPF.DataGrid.Summaries.4.dll” couldn’t be found. I already make sure, that the files really exist in the addin directory.
If i move the missing DLLs to the base directory of the appdomain (E:\EplanP8\Platform\Bin) everything works fine.
I have also tried to setup an assembly resolver with following code:
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
// Ignore missing resources
if (args.Name.Contains(".resources"))
{
return null;
}
// check for assemblies already loaded
var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName == args.Name);
if (assembly != null)
{
return assembly;
}
// Try to load by filename - split out the filename of the full assembly name
// and append the base path of the original assembly (ie. look in the same dir)
var filename = args.Name.Split(',')[0] + ".dll".ToLower();
var asmFile = Path.Combine(@"E:\EplanP8\Custom Addins\", filename);
try
{
var assemblyFromFile = Assembly.LoadFrom(asmFile);
return assemblyFromFile;
}
catch
{
// do nothing
return null;
}
}
can anyone tell me, what i am doin wrong or what is missing in my case?
thanks.
Chris