RegisterXLL from VSTO

Jan 27, 2010 at 8:36 AM

Hi

Has anyone managed to use Application.RegisterXLL on an ExcelDna add-in from within a VSTO add-in?

I've signed and code-signed everything that could possibly be signed (incl. manifests)...next step is getting a Papal Bulla for the DLLs! :-)

And yet, the first time the unmanaged ExcelDna C++ crosses into the managed ExcelDna.Loader with

hr = pXlAddInType->InvokeMember_3(CComBSTR("Initialize"),...

I get the dreaded

That assembly does not allow partially trusted callers. (HRESULT 0x8013150A)

The singing certificate shows up in Excel's Distrust Center (as trusted).

I granted FullTrust to the publisher certificate with the following

caspol.exe -q -machine -addgroup 1 -pub -cert "my.cer" FullTrust

But if I check, then I get the following

c:\>CasPol.exe -rsg ExcelDna.xll
...
WARNING: The assembly at VTB.QR.xll cannot be loaded.  Caspol can make a partial determination of what evidence would be
 associated with this assembly.  The results of the following operation are not necessarily accurate or complete.
...the rest of the output says FullTrust...

Incidentally, after adding the following (signed) manifest to ExcelDna, the XLL does not load into Excel stand-alone anymore (so without VSTO). I guess this is the first problem I should solve, right?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity name="ExcelDna.xll" processorArchitecture="x86" type="win32" version="1.0.0.21"></assemblyIdentity>
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
            </requestedPrivileges>
        </security>
    </trustInfo>
</assembly>

I appeal to the VSTO/manifest/religious experts out there, as I'm running out of options, hope and faith altogether...desperate, really :-)

Thanks very much in advance!

Coordinator
Jan 27, 2010 at 10:44 AM

I have cross-posted to the Google group (http://groups.google.com/group/exceldna).

You might like to search for VSTO on the Google group. This issue has appeared before, and I don't understand the special security context that VSTO runs under. I only know that security with VSTO is unusual - they don't just follow the expected .Net security access. It is one of the quirks with VSTO that make me prefer ExcelDna, where everything is a bit simpler. Google for "VSTO Security" as a start.

Some people have certainly been able to get VSTO and ExcelDna to work together; if we get no response on CodePlex on Google, I can trawl through my old e-mails to see if I find someone for you to contact.

--Govert--

Coordinator
Jan 27, 2010 at 10:47 AM

As another thing to try, you might keep the ExcelDna.Loader.dll and ExcelDna.Integration.dll outside the ExcelDna.xll file where I normally pack it. Then these will be loaded in a different load-context - perhaps the security black is because of the Assembly.Load(byte[] ...) context that I use...?

Jan 27, 2010 at 11:20 AM

Thanks

Unfortunately keeping the Loader and Integration assemblies out of the XLL does not work for me

Fusion log...yet another tool I didn't know of and should prob become acquainted with...

Will try that one, and post to the google group then...