Embedded Assemblies not working

Add-in Express™ Support Service
That's what is more important than anything else

Embedded Assemblies not working
 
ewessely




Posts: 35
Joined: 2019-01-31
Hello,
my Addin uses additional assemblies (via Nuget) which I want to combine into the addin.
I tried ILRepack and Fody/Costura. Both integrate the additional dlls during the build process correctly.
I'm able to register my AddIn in VS correctly and it is working.
The problem is when I try to distribute the AddIn (VS setup project).
The adxregistrator gives me an error:

Exception Message: Could not load file or assembly ....<my embedded assembly>.... or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Do you have any ideas / suggestions?

What are the differences between registering an AddIn with VS and with adxregistrator?

Many thanks
Erich
ew
Posted 29 Oct, 2019 04:27:23 Top
Andrei Smolin


Add-in Express team


Posts: 17370
Joined: 2006-05-11
Hello Erich,

You need to compare the project output with what the installer deploys. If something is used from GAC, it must also be deployed.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 30 Oct, 2019 02:49:39 Top
ewessely




Posts: 35
Joined: 2019-01-31
Hello Andrei,
I investigated the whole day for figuring out more details.
The (with costura/fody) emedded dlls are not in the GAC and not in the output-folder (bin/debug).
It seems, that clicking Add-In Express -> Register works different than adxregistrator.
Registering in VS works fine and all is working as expected.
Doing the same with the adxregistrator gives me an error: Could not load file or assembly....

BUT:
If I include the dlls (which are also embedded in my AddIn) in the setup and do the registration with adxregistrator, the registration process works without an error. When you then (before!!! starting Excel the first time) delete those dlls, the Add In is still working and loads the embedded dlls correctly.

So it seems only a problem during the registration.

Any ideas / hints?

Best regards
Erich
ew
Posted 30 Oct, 2019 13:41:34 Top
ewessely




Posts: 35
Joined: 2019-01-31
Hello Andrei,
SOLVED!!! :-)
My fault - sorry. I had some code behind the "InitializeComponent" instead of the AddinInitialize event handler.
Moving the line to the eventhandler solved my problem.

Many thanks for your support!

Erich
ew
Posted 30 Oct, 2019 14:25:48 Top
Andrei Smolin


Add-in Express team


Posts: 17370
Joined: 2006-05-11
Wow! My congratulations!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 31 Oct, 2019 02:03:50 Top