saurabh vats
saurabh vats

Reputation: 369

Excel DNA packing issue

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" /Y

But 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>

Upvotes: 3

Views: 3432

Answers (1)

saurabh vats
saurabh vats

Reputation: 369

My issue got resolved I checked that in the output 'Reference with Path: System.Threading.Tasks.Dataflow.dll and Name: not found.' after this exception rest of the references were getting ignored.

I checked that the dll reference for which the error was coming is no more in use in our project after removing reference for this dll everything worked fine.

Upvotes: 1

Related Questions