Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrading from 1.5.1 to 1.6.0 causes invalid XLL file #576

Open
Eddict opened this issue Mar 2, 2023 · 3 comments
Open

upgrading from 1.5.1 to 1.6.0 causes invalid XLL file #576

Eddict opened this issue Mar 2, 2023 · 3 comments

Comments

@Eddict
Copy link

Eddict commented Mar 2, 2023

i was upgrading a project from 1.5.1 to 1.6.0 but Excel gave me the (in)famous "ActiveX component can't create object" error. upon investigating i unzipped/extracted the EXCELDNA file from the XLL file.
in 1.5.1 that is also a zip compressed file (containing folder ".rsrc" and files ".reloc" and ".text"), but in 1.6.0 it is not a zip compressed file, but i don't what it is. opening the XLL in Excel will give an unsupported format error.

file attached; EXCELDNA (renamed to EXCELDNA.zip for upload policy reasons)

any idea(s)?

@govert
Copy link
Member

govert commented Mar 2, 2023

Is this the error you refer to - I also post about the solution there.
https://groups.google.com/g/exceldna/c/onRDZLJwoBY/m/ddsjBDbsBAAJ

The main discovery I made in February that is relevant to your question relates to how COM interfaces are exposed with .NET 6.
You now need an explicit 'default interface' for your type - this will cause the class to implement IDispatch (if it is ComVisible).
So you can change your code with an empty interface like this:

    public interface IMyUserControl { }

    [ComVisible(true)]
    [Guid("E2197CEB-6ADC-4EAB-80FD-0A9EE161BA14")]
    [ComDefaultInterface(typeof(IMyUserControl))]
    public class MyUserControl : UserControl, IMyUserControl { }

@Eddict
Copy link
Author

Eddict commented Mar 3, 2023

Is this the error you refer to - I also post about the solution there. https://groups.google.com/g/exceldna/c/onRDZLJwoBY/m/ddsjBDbsBAAJ

no it is not. i tried your suggestion though but same outcome.
so what about the fact that the EXCELDNA file (the only file inside the XLL archive) is not a zip file anymore? is that expected/new in 1.6.0?

@govert
Copy link
Member

govert commented Mar 4, 2023

The XLL file is not an archive. It is a normal Windows .dll file.
It has some assemblies embedded as resources. By default, these assemblies are embedded:

  • EXCELDNA.MANAGEDHOST
  • EXCELDNA.INTEGRATION
  • EXCELDNA.LOADER

Unless your project is called "ExcelDna" there will not be an embedded assembly just called "EXCELDNA".
But I assume you are referring to one of the other assemblies.

These embedded resources are sometimes compressed too (to make the .XLL file smaller). This compression was removed in some of the 1.6.x versions, leaving the assembly embedded without compression.

In addition, we tried some obfuscation too, using a simple encoding on the embedded assemblies.
This was to see if the false-positive detections from anti virus programs can be reduced.

In the end it seemed the encoding made things worse, and so we reverted back to compression only in the latest preview versions. You might try 1.7.0-rc1 as an indication of where we stand now.

I don't expect any of these changes to cause an "invalid XLL file" or to give you an "ActiveX component can't create object" error. You might be mixing some observations about the implementation of the embedded resource packing, with other problems you are running into.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants