Excel DNA 包装问题

Excel DNA packing issue

我正在尝试使用 ExcelDNApack.exe 将我所有的 dll 打包到 XLL 中,为此我使用下面的命令及其为我生成的 pack xll 文件。

"$(SolutionDir)dependencies\Excel-DNA.0.32.0\tools\ExcelDnaPack.exe" 
"$(TargetDir)ExcelTrader-AddIn.dna" /Y

但是当我 运行 来自我没有依赖 dll 的文件夹中的 xll 文件时,它会抛出异常 "An Exception occured while calling function OnLoad"。异常消息是无法加载文件或程序集 'OpenApiSecurityLib, version=1.0.0.0,Culture=neutral,PublicKeyToken=null'

我有一个引用 OpenAPISecurityLib.dll 和 OpenAPIClientLib.dll 的主项目 ExcelTrader.dll,我在 dna 文件中为这些 dll 和依赖项添加了 Reference 属性,并为 ExcelTrader.dll

如果我将 OpenAPISecurityLib.dll 和 OpenAPIClientLib.dll 都放在与 xll 文件相同的文件夹中,XLL 文件运行得很好

请指出我做错了什么谢谢

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

我的问题已解决 我在输出 'Reference with Path: System.Threading.Tasks.Dataflow.dll and Name: not found.' 中检查了此异常后其余的引用都被忽略了。

我检查了出现错误的 dll 引用在删除对该 dll 的引用后在我们的项目中不再使用,一切正常。