Like some other posters, I am having trouble using NetOffice with ILMerge.
I use NetOffice with Excel, through both add-ins and stand-alone apps. My apps or add-ins will run fine before merging, but after merging I will get "Factory has not been initialized with NetOffice libraries" exceptions in different places. Some references to classes in ExcelApi.dll or the other NetOffice libraries will work fine, but some will not.
The current example that I'm stuck on is with the ExcelApi.Application.AddIns property. I can get a reference to an AddIn object with an expression like
I've tried explicitly calling
I've looked at the source code for the Core/Factory object and my guess is that it has to do with the factory loading assemblies by name. Is this correct? How can I get around this?
I use NetOffice with Excel, through both add-ins and stand-alone apps. My apps or add-ins will run fine before merging, but after merging I will get "Factory has not been initialized with NetOffice libraries" exceptions in different places. Some references to classes in ExcelApi.dll or the other NetOffice libraries will work fine, but some will not.
The current example that I'm stuck on is with the ExcelApi.Application.AddIns property. I can get a reference to an AddIn object with an expression like
AddIn a = app.AddIns.Add(filepath);
but I cannot query the contents of an AddIns collection with an expression like foreach (AddIn a in app.Addins) do stuff;
This will give me the "Factory not initialized" exception, but only if I've use ILMerge.I've tried explicitly calling
NetOffice.Core.Default.Initialize();
but that does not change anything.I've looked at the source code for the Core/Factory object and my guess is that it has to do with the factory loading assemblies by name. Is this correct? How can I get around this?