Add-in registration fails when embeding dependant assemblies

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

Add-in registration fails when embeding dependant assemblies
 
OliverM


Guest


I am trying to embed all 3rd party assemblies used in my project. The idea is to enable deep integration of the licensing and obfuscation modules. The merge is done by the obfuscator and I tested it by simply copying the obfuscated library back to the my add-ins \debug\bin folder. Works like a charme.

In the next step I created an MSI based setup and rather than adding the 'primary output', I added the obfuscated lib, ADX loader libs and adxregistrator manually. Also added custom actions in order to register/unregister my add-in.

Checking the adxregistrator.log I found the following error: The located assembly's manifest definition does not match the assembly reference. The log4net lib is merged in my add-in dll.

Any idea how to solve that?

Kind regards
Oliver



Installation directory: C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\
Registrator version: 8.0.4330.0
Operating System: Microsoft (build 9200), 64-bit
Process Owner: Administrator
Command Line: "C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\adxregistrator.exe" /Install="MyAddIn.dll" /privileges=user
Run 'As Administrator': Yes
Process Elevated: Yes
Integrity Level: High
UAC (User Account Control): On
--------------------------------------------------------------
10:30:58 0284 Starting the add-in registration process.
10:30:58 0284 Loading mscoree.dll
10:30:58 0284 Success.
10:30:58 0284 .NET Framework installation directory:
10:30:58 0284 The latest version of .NET Framework: 'v4.0.30319'
10:30:58 0284 Loading CLR: v4.0.30319.
10:30:58 0284 Calling CLRCreateInstance method.
10:30:58 0284 Success.
10:30:58 0284 Calling GetRuntime method.
10:30:58 0284 Success.
10:30:58 0284 Checking if the hosting API of .NET Framework v4.0 beta is installed.
10:30:58 0284 The hosting API is up to date.
10:30:58 0284 Calling GetInterface method for the CorRuntimeHost interface.
10:30:58 0284 Success.
10:30:58 0284 Starting CLR...
10:30:58 0284 Success.
10:30:58 0284 Getting the CLR version.
10:30:58 0284 The CLR v4.0.30319 has been initialized successfully.
10:30:58 0284 Creating a new domain setup.
10:30:58 0284 Success.
10:30:58 0284 Getting the add-in directory.
10:30:58 0284 Success. The directory is 'C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\'
10:30:58 0284 The 'shadow copy' is disabled.
10:30:58 0284 Creating a new application domain.
10:30:58 0284 Success.
10:30:58 0284 Getting the base directory for the domain.
10:30:58 0284 Success. The directory is 'C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\'.
10:30:58 0284 Searching for the Add-in Express core library.
10:30:58 0284 Success. The 'AddinExpress.MSO.2005.dll' file is found.
10:30:58 0284 Creating an instance of the 'AddinExpress.Deployment.ADXRegistrator' class.
10:30:58 0284 Assembly identity is 'AddinExpress.MSO.2005'.
10:30:58 0284 Success.
10:30:58 0284 Unwrapping the instance of the 'AddinExpress.Deployment.ADXRegistrator' class.
10:30:58 0284 Success.
10:30:58 0284 Calling the managed registration procedure (DISPID = 1610743823).
10:30:59 0284 Managed Error:

(Inner Exception)
Date and Time: 05/02/2016 10:30:59
Machine Name: BADATTITUDE
IP Address: fe80::694f:ac0b:e010:8b75%8
Current User: BADATTITUDE\tom

Application Domain: C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\
Assembly Codebase: file:///C:/Windows/assembly/GAC_MSIL/AddinExpress.MSO.2005/8.0.4330.0__4416dd98f0861965/AddinExpress.MSO.2005.dll
Assembly Full Name: AddinExpress.MSO.2005, Version=8.0.4330.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 8.0.4330.0

Exception Source:
Exception Type: System.IO.FileLoadException
Exception Message: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

---- Stack Trace ----



(Outer Exception)
Date and Time: 05/02/2016 10:30:59
Machine Name: BADATTITUDE
IP Address: fe80::694f:ac0b:e010:8b75%8
Current User: BADATTITUDE\tom

Application Domain: C:\Users\tom\AppData\Roaming\MyCompany\MyAddIn\
Assembly Codebase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
Assembly Full Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly Version: 4.0.0.0

Exception Source: mscorlib
Exception Type: System.IO.FileLoadException
Exception Message: Could not load file or assembly 'log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Exception Target Site: GetExportedTypes

---- Stack Trace ----
System.Reflection.RuntimeAssembly.GetExportedTypes(assembly As RuntimeAssembly, retTypes As ObjectHandleOnStack)
mscorlib.dll: N 00000 (0x0) JIT
System.Reflection.RuntimeAssembly.GetExportedTypes()
mscorlib.dll: N 0000 (0x0) IL
AddinExpress.Projects.Common.Utilities.GetRegistrableTypesInAssembly(assembly As Assembly)
mscorlib.dll: N 0006 (0x6) IL
AddinExpress.Projects.Common.Utilities.RegisterAssembly(assembly As Assembly, createVersionKey As Boolean, allUsers As Boolean, targetHive As ADXTargetRegistryHive, callRegMethod As Boolean)
mscorlib.dll: N 0000 (0x0) IL
AddinExpress.Deployment.AddinDomainAdapter.RegisterForComInterop(register As Boolean, dllType As String, dllPath As String, showExceptions As Boolean)
mscorlib.dll: N 0205 (0xCD) IL
AddinExpress.Deployment.ADXRegistrator.RegisterAssembly(commandLine As String)
mscorlib.dll: N 0705 (0x2C1) IL



10:30:59 0284 The add-in registration process is completed with HRESULT = -2147467259.
Posted 05 Feb, 2016 05:18:35 Top
OliverM


Guest


Update: Issue is solved.

It was a sequence problem. Combining main assembly and setup assembly in the same solution seems not to be the best idea when working with obfuscated code, as building the setup also triggers a main assembly build.
What solved my problem was temporarily unloading the project I do not want to build.
Posted 05 Feb, 2016 14:53:20 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Thank you, Oliver, for sharing your solution with forum readers!


Andrei Smolin
Add-in Express Team Leader
Posted 08 Feb, 2016 03:43:42 Top