我们正在尝试设置 Jenkins(构建服务器)作业来构建基于 VSTO 的 Office 加载项.但是,在将 DLL 复制到项目的 bin
目录后,我不断收到一个奇怪的错误,即构建过程失败:
We're trying to set up a Jenkins (build server) job to build our Office add-in based on VSTO. However, I keep getting a strange error that fails the build process after the DLL is copied to the bin
directory of the project:
Error 11 The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException:
Could not load file or assembly 'MyAddIn, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.
File name: 'MyAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
所以问题是由 Office 加载项构建目标触发的FindRibbons"任务已成功将 MyAddIn DLL 识别为 Office 加载项,但无法找到并加载它!
So the problem is that the "FindRibbons" task, triggered by the Office add-in build target, has successfully identified the MyAddIn DLL as being an Office Add-In, but is not able to locate and load it!
有什么想法吗?我希望能够直接调试 FindRibbons 任务,但挂钩和调试编译过程似乎有点极端......
Any ideas? I'd love to be able to debug the FindRibbons task directly but hooking into and debugging the compile process seems a little extreme...
以下是一些观察:
C:WindowsMicrosoft.NETFrameworkv4.0.30319
) 其他地方都没有.在我的开发机器上,没有 MyAddIn 的 Fusion 日志条目!但构建过程成功并且 Kivo 工作正常.WhereRefBind!Host=(LocalMachine)!FileName=(PresentationCore.dll)
和 ExplicitBind!FileName=(MyAddIn.dll)
显示绑定成功.C:WindowsMicrosoft.NETFrameworkv4.0.30319
) and nowhere else.
On my dev machine, there is no Fusion log entry for MyAddIn! But the build process succeeds and Kivo works fine.WhereRefBind!Host=(LocalMachine)!FileName=(PresentationCore.dll)
and ExplicitBind!FileName=(MyAddIn.dll)
which show the binding succeeding.这对我每次升级 Visual Studio 时都有效——顺便说一句,我不使用功能区.
This has worked for me everytime I upgrade Visual Studio - I don't use ribbons btw.
这适用于我的解决方案,但使用风险自负:
This worked for my solution, but use at your own risk:
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0OfficeToolsMicrosoft.VisualStudio.Tools.Office.目标
(v10.0 部分对你来说可能不同,例如它可能是 v14.0)删除以下部分:
C:Program Files (x86)MSBuildMicrosoftVisualStudiov10.0OfficeToolsMicrosoft.VisualStudio.Tools.Office.targets
(the v10.0 part may be different for you, e.g. it might be v14.0)Remove the following section:
<FindRibbons AssemblyName="$(AbsolutePathToCustomization)" TargetFramework="$(TargetFrameworkVersion)">
<Output TaskParameter="RibbonTypes" ItemName="RibbonTypesCollection"/>
</FindRibbons>
将所有出现的 "@(RibbonTypesCollection)"
替换为 "" 4. 保存文件并重新启动 Visual Studio
Replace all occurrences of "@(RibbonTypesCollection)"
with "" 4. Save the file and restart visual studio
这篇关于构建 Office 加载项时的程序集绑定错误:“FindRibbons"任务意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!