为Outlook 2010构建插件时,FindRibbons任务意外失败

本文关键字:FindRibbons 任务 意外 失败 Outlook 2010 构建 插件 | 更新日期: 2023-09-27 18:01:57

我们正在使用VS2013, . net 4, Microsoft Async和BCL可移植性(从Nuget)构建Outlook 2010插件,并遇到类似于这个问题的构建错误,不幸的是,这些资源(或其他互联网)都没有帮助解决我们的问题。

构建错误和Fusion日志在底部。我的第一个问题:

如何解决这个FindRibbons构建任务?把它从VS目标文件中完全移除可以让构建完成,但代价是没有ribbon控件。

第二个症状是Fusion日志的Attempting download部分。DLL在我们的项目bin'Debug目录下构建,所以其他目录搜索是奇怪的。这就引出了我的第二个问题:

Fusion日志中是否有我们忽略的症状?

最后一个症状来自详细的构建日志,我们在其中看到mscorlib, System。Core和其他一些库。这些依赖关系通过Bcl等进入,而4.0.0.0与2.0.5.0的冲突似乎可能会阻止构建或生成FileNotFoundException。我们尝试了绑定重定向等一些补救措施,但无法使此工作。最后一个问题:

此版本构建冲突的解决方案或故障排除提示?

提前感谢。抱歉这么长时间。

如所承诺的构建失败:

Error    1    The "FindRibbons" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'myDocketOutlookAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'myDocketOutlookAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Server stack trace: 
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
    at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
    at System.Reflection.Assembly.Load(String assemblyString)
    at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
    at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder) 
    at System.Runtime.Serialization.ObjectManager.DoFixups()
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
    at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.FixupForNewAppDomain()
    at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)
Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at Microsoft.Build.Framework.ITask.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Assembly manager loaded from: C:'Windows'Microsoft.NET'Framework'v4.0.30319'clr.dll
Running under executable C:'Program Files (x86)'MSBuild'12.0'bin'MSBuild.exe
--- A detailed error log follows. 
=== Pre-bind state information ===
LOG: DisplayName = myDocketOutlookAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: DEVPATH = C:'ProgramData'Red Gate'.NET Reflector'DevPath
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:'Program Files (x86)'MSBuild'12.0'bin'MSBuild.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:'Windows'Microsoft.NET'Framework'v4.0.30319'config'machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/myDocketOutlookAddIn.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/myDocketOutlookAddIn/myDocketOutlookAddIn.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/myDocketOutlookAddIn.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/myDocketOutlookAddIn/myDocketOutlookAddIn.EXE.

和构建版本冲突摘录:

There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". (TaskId:7)
      "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not. (TaskId:7)
      References which depend on "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" [C:'Program Files (x86)'Reference Assemblies'Microsoft'Framework'.NETFramework'v4.0'mscorlib.dll]. (TaskId:7)
          C:'Program Files (x86)'Reference Assemblies'Microsoft'Framework'.NETFramework'v4.0'mscorlib.dll (TaskId:7)
            Project file item includes which caused reference "C:'Program Files (x86)'Reference Assemblies'Microsoft'Framework'.NETFramework'v4.0'mscorlib.dll". (TaskId:7)
              System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL (TaskId:7)
              Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL (TaskId:7)
 ...
      References which depend on "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" []. (TaskId:7)
          c:'code'Projects'myDocketForOutlook'packages'Microsoft.Bcl.1.1.9'lib'net40'System.IO.dll (TaskId:7)
            Project file item includes which caused reference "c:'code'Projects'myDocketForOutlook'packages'Microsoft.Bcl.1.1.9'lib'net40'System.IO.dll". (TaskId:7)
              System.IO (TaskId:7)
          c:'code'Projects'myDocketForOutlook'packages'Microsoft.Bcl.1.1.9'lib'net40'System.Threading.Tasks.dll (TaskId:7)
            Project file item includes which caused reference "c:'code'Projects'myDocketForOutlook'packages'Microsoft.Bcl.1.1.9'lib'net40'System.Threading.Tasks.dll". (TaskId:7)
              Microsoft.Threading.Tasks (TaskId:7)
This pattern then repeats for System.Core, System, and System.Net

为Outlook 2010构建插件时,FindRibbons任务意外失败

需要删除AssemblyInfo.cs文件末尾的SecurityTransparent属性

我在将Visual Studio 2010 VSTO项目升级到Visual Studio 2013时遇到了同样的问题。我解决这个问题的方法是结合两件事:

首先,我从AssemblyInfo.vb

中删除了对程序集属性SecurityTransparent的引用
<Assembly: SecurityTransparent()>

第二,我在Microsoft.Office.Tools.Common.v4.0上设置Copy Local = true。公用事业公司参考。

我能够通过在.csproj中添加显式的汇编版本引用来修复此错误。