I am trying to pack all my dlls into XLL using the ExcelDNApack.exe, for this I am using below command and its generating pack xll file for me.
"$(SolutionDir)dependencies\Excel-DNA.0.32.0\tools\ExcelDnaPack.exe"
"$(TargetDir)ExcelTrader-AddIn.dna" /YBut when I am running the xll file from the folder where I dont have dependent dlls its throwing an exception "An Exception occured while calling function OnLoad". The exception message is Could not load file or assembly 'OpenApiSecurityLib, version=1.0.0.0,Culture=neutral,PublicKeyToken=null'
I have a main project ExcelTrader.dll which references OpenAPISecurityLib.dll and OpenAPIClientLib.dll, I have added Reference attribute in the dna file for both these dlls and dependencies and added ExternalLibrary attribute for ExcelTrader.dll
If I put both OpenAPISecurityLib.dll and OpenAPIClientLib.dll in the same folder as xll file, XLL file runs perfectly fine
Please suggest what is that I am doing wrong here Thanks
<DnaLibrary Name="ExcelTrader Add-In" RuntimeVersion="v4.0">
<Reference Path="Newtonsoft.Json.dll" Pack="true" />
<Reference Path="NLog.dll" Pack="true" />
<Reference Path="Microsoft.Practices.Unity.Configuration.dll" Pack="true" />
<Reference Path="Microsoft.Practices.Unity.dll" Pack="true" />
<Reference Path="Microsoft.Practices.Unity.RegistrationByConvention.dll" Pack="true" />
<Reference Path="Microsoft.AspNet.SignalR.Client.dll" Pack="true" />
<Reference Path="System.Threading.Tasks.Dataflow.dll" Pack="true" />
<Reference Path="System.Net.Http.Formatting.dll" Pack="true"/>
<Reference Path="OpenApiClientLib.dll" Pack="true" />
<Reference Path="OpenApiSecurityLib.dll" Pack="true" />
<ExternalLibrary Path="ExcelTrader.dll" Pack="true" />
<!-- Some images that can be used in the Ribbon ui -->
<Image Name="Login" Path="Images\Login.gif" Pack="true" />
<Image Name="LogOut" Path="Images\LogOut.png" Pack="true" />
<CustomUI>
<customUI xmlns='http://schemas.microsoft.com/office/2006/01/customui' loadImage='LoadImage' onLoad='OnLoad'>
<ribbon>
<tabs>
<tab id='CustomTab' label='Excel Trader'>
<group id='loginCtrl' label='Login Control'>
<button id='btnLogin' label='Login' getEnabled='GetEnabled' image='Login' size='large' onAction='OnLogin' />
<button id='btnLogOut' label='LogOut' image='LogOut' size='large' onAction='OnLogOut' />
</group >
</tab>
</tabs>
</ribbon>
</customUI>
</CustomUI>
</DnaLibrary>Hi Saurabh,
This ExcelDnaPack output is not related to the .dna file or problem message that you posted earlier.
You might want to check both and look at a matching set of .dna file and ExcelDnaPack output.
-Govert
From: exce...@googlegroups.com [mailto:exce...@googlegroups.com]
On Behalf Of saurabh vats
Sent: 8 July 2015 14:29
To: exce...@googlegroups.com
Subject: Re: [ExcelDna] Excel DNA packing issue
Hi Govert
Thanks for your quick reply!
Output is given below
Output .xll file D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\SaxoExcelTrader-AddIn-packed.xll already exists. Overwrite? [Y/N] Using base add-in D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\SaxoExcelTrader-AddIn.xll
-> Updating resource: Type: ASSEMBLY_LZMA, Name: EXCELDNA.INTEGRATION, Length: 60383
-> Updating resource: Type: CONFIG, Name: __MAIN__, Length: 1537
~~> ExternalLibrary path SaxoExcelTrader.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\SaxoExcelTrader.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: SAXOEXCELTRADER, Length: 20812
~~> Assembly path Newtonsoft.Json.xml resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Newtonsoft.Json.xml.
Assembly at D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Newtonsoft.Json.xml could not be packed. Possibly a mixed assembly? (These are not supported yet.)
Exception: System.BadImageFormatException: Could not load file or assembly '494336 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: '494336 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' ---> System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at ResourceHelper.ResourceUpdater.AddAssembly(String path)
~~> Assembly path Newtonsoft.Json.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Newtonsoft.Json.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: NEWTONSOFT.JSON, Length: 152621
~~> Assembly path NLog.xml resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\NLog.xml.
Assembly at D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\NLog.xml could not be packed. Possibly a mixed assembly? (These are not supported yet.)
Exception: System.BadImageFormatException: Could not load file or assembly '807132 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: '807132 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' ---> System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at ResourceHelper.ResourceUpdater.AddAssembly(String path)
~~> Assembly path NLog.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\NLog.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: NLOG, Length: 119256
~~> Assembly path Microsoft.Practices.Unity.Configuration.xml resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.Configuration.xml.
Assembly at D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.Configuration.xml could not be packed. Possibly a mixed assembly? (These are not supported yet.)
Exception: System.BadImageFormatException: Could not load file or assembly '149712 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: '149712 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' ---> System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at ResourceHelper.ResourceUpdater.AddAssembly(String path)
~~> Assembly path Microsoft.Practices.Unity.Configuration.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.Configuration.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: MICROSOFT.PRACTICES.UNITY.CONFIGURATION, Length: 30406
~~> Assembly path Microsoft.Practices.Unity.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: MICROSOFT.PRACTICES.UNITY, Length: 46022
~~> Assembly path Microsoft.Practices.Unity.RegistrationByConvention.xml resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.RegistrationByConvention.xml.
Assembly at D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.RegistrationByConvention.xml could not be packed. Possibly a mixed assembly? (These are not supported yet.)
Exception: System.BadImageFormatException: Could not load file or assembly '19634 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: '19634 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' ---> System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at ResourceHelper.ResourceUpdater.AddAssembly(String path)
~~> Assembly path Microsoft.Practices.Unity.RegistrationByConvention.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.Practices.Unity.RegistrationByConvention.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: MICROSOFT.PRACTICES.UNITY.REGISTRATIONBYCONVENTION, Length: 12868
~~> Assembly path Microsoft.AspNet.SignalR.Client.xml resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.AspNet.SignalR.Client.xml.
Assembly at D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.AspNet.SignalR.Client.xml could not be packed. Possibly a mixed assembly? (These are not supported yet.)
Exception: System.BadImageFormatException: Could not load file or assembly '51957 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: '51957 bytes loaded from ExcelDnaPack, Version=0.32.5236.31802, Culture=neutral, PublicKeyToken=null' ---> System.BadImageFormatException: Bad IL format.
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly)
at ResourceHelper.ResourceUpdater.AddAssembly(String path)
~~> Assembly path Microsoft.AspNet.SignalR.Client.dll resolved to D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\Microsoft.AspNet.SignalR.Client.dll.
-> Updating resource: Type: ASSEMBLY_LZMA, Name: MICROSOFT.ASPNET.SIGNALR.CLIENT, Length: 48895
~~> Assembly path System.Threading.Tasks.Dataflow.dll resolved to .
~~> Reference with Path: System.Threading.Tasks.Dataflow.dll and Name: not found.
-> Updating resource: Type: IMAGE_LZMA, Name: LOGIN_0.GIF, Length: 9739
-> Updating resource: Type: IMAGE_LZMA, Name: LOGOUT_1.PNG, Length: 9265
-> Updating resource: Type: DNA, Name: __MAIN__, Length: 2192
Completed Packing D:\ExcelTrader\SaxoExcelTrader\Source\SaxoExcelTrader\bin\Debug\SaxoExcelTrader-AddIn-packed.xll.
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.