ExcelDna icon indicating copy to clipboard operation
ExcelDna copied to clipboard

Investigate assembly redirection in .xll.config files

Open govert opened this issue 8 years ago • 6 comments

It seems that assembly redirection specified in .xll.config files is not applied. Investigate and document or fix.

govert avatar Oct 21 '15 13:10 govert

Related thread: https://groups.google.com/forum/#!topic/exceldna/ZUd1kckJblA

augustoproiete avatar Oct 21 '15 23:10 augustoproiete

Below is a reproduction scenario.

(0. Get Portable.Licensing using NuGet.)

  1. Compile the cs file to a dll
  2. Pack with ExcelDnaPack to an xll
  3. Copy the xll file to a directory without System.Xml.Linq.
  4. 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()");
    }
  }
}

henningniss avatar Nov 02 '15 15:11 henningniss

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

konne avatar Nov 02 '15 18:11 konne

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

henningniss avatar Nov 03 '15 07:11 henningniss

any update on this issue?

stonefly avatar Jun 16 '16 19:06 stonefly

I've not had a closer look at this yet.

govert avatar Jun 16 '16 20:06 govert