ExcelDna
ExcelDna copied to clipboard
Investigate assembly redirection in .xll.config files
It seems that assembly redirection specified in .xll.config files is not applied. Investigate and document or fix.
Related thread: https://groups.google.com/forum/#!topic/exceldna/ZUd1kckJblA
Below is a reproduction scenario.
(0. Get Portable.Licensing using NuGet.)
- Compile the cs file to a dll
- Pack with ExcelDnaPack to an xll
- Copy the xll file to a directory without System.Xml.Linq.
- Start Excel with the xll and inspect the debug output.
This uses reproduction scenario uses Portable.Licensing as an example, but I am sure other libraries referencing portable versions of GAC'ed dll's would illustrate the problem just as well.
DNA: <DnaLibrary Language="CS" RuntimeVersion="v4.0"> <ExternalLibrary Path="MyAddIn.dll" Pack="true" /> <Reference Path="Portable.Licensing.dll" Pack="true" /> </DnaLibrary>
CS:
using System;
using System.Diagnostics;
using ExcelDna.Integration;
using Portable.Licensing;
namespace MyAddIn
{
public sealed class MyAddInHelper : IExcelAddIn
{
public void AutoOpen()
{
Debug.WriteLine("In AutoOpen()");
try
{
var contents = "<?xml version=\"1.0\" encoding=\"utf-8\"?><gibberish />";
var license = License.Load(contents);
}
catch (Exception e)
{
Debug.WriteLine("Exception: {0}", e.Message);
throw;
}
}
public void AutoClose()
{
Debug.WriteLine("In AutoClose()");
}
}
}
Hi henningniss , What I miss in your DNA File is the bouncing castle dll, but I didn't test your problem till now. If you like you can also check my branch version. https://github.com/konne/ExcelDna I have changed the whole area for finding the right assembly and I also solved the issue with portable dlls (I had the problem with autofac) If you don't get your test working with my branch I will try to test this in the end of week and debug into this issue.
bye Konrad
Hi Konrad
Forgive my ignorance, but I thought that Bouncy Castle (to the extent that I knew of its existence) was already part of the Portable.Licensing dll, and hence not required as a separate dependency.
I'll try to find some time to test your branch as well.
Henning
any update on this issue?
I've not had a closer look at this yet.