title: FindRibbons task failed unexpectedly when building addin for Outlook 2010
body: <p>We're building an Outlook 2010 plugin using VS2013, .NET4, Microsoft Async and BCL Portability (from Nuget) and encountering build errors similar to <a href="https://stackoverflow.com/questions/20220031/assembly-binding-error-when-building-office-add-in-findribbons-task-failed-un">this question</a> and <a href="https://connect.microsoft.com/VisualStudio/feedback/details/651634/the-findribbons-task-failed-unexpectedly#tabs" rel="nofollow">this forum discussion</a> unfortunately neither of these resources (or the rest of the internet) have helped resolve our problem. </p>
  
  <p>The build error and Fusion log are at bottom.  My first question:</p>
  
  <blockquote>
    <p>How does one troubleshoot this FindRibbons build task?  Removing it entirely from the VS targets file allows the build to complete, but at the expense of no ribbon controls.</p>
  </blockquote>
  
  <p>The second symptom we have is the <code>Attempting download</code> section of the Fusion log.  The DLL gets built under our project <code>bin\Debug</code> directory so the other directory search is odd.  Which raises my second question:</p>
  
  <blockquote>
    <p>Are there symptoms in the Fusion log that we're overlooking?</p>
  </blockquote>
  
  <p>The last symptom is from the detailed build log where we see conflicts between mscorlib, System.Core and a couple other libraries.  These dependencies come in via the Bcl, etc. and the 4.0.0.0 vs. 2.0.5.0 conflict seems like that could prevent a build or generate a FileNotFoundException.  We tried a number of remedies with binding redirection, etc. but couldn't make this work.  So last question:</p>
  
  <blockquote>
    <p>Solutions or troubleshooting tips for this version build conflict?  </p>
  </blockquote>
  
  <p>Many thanks in advance.  Sorry for the length.  </p>
  
  <p>As promised the build failure:</p>
  
  <pre><code>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&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
      at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
      at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
      at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
      at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; 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&amp; msgData, Int32 type)
      at Microsoft.Build.Framework.ITask.Execute()
      at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
      at Microsoft.Build.BackEnd.TaskBuilder.&lt;ExecuteInstantiatedTask&gt;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.
  </code></pre>
  
  <p>And the build version conflict excerpt:</p>
  
  <pre><code>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
  </code></pre>