Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FindRibbons task failed unexpectedly when building addin for Outlook 2010

We're building an Outlook 2010 plugin using VS2013, .NET4, Microsoft Async and BCL Portability (from Nuget) and encountering build errors similar to this question and this forum discussion unfortunately neither of these resources (or the rest of the internet) have helped resolve our problem.

The build error and Fusion log are at bottom. My first question:

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.

The second symptom we have is the Attempting download section of the Fusion log. The DLL gets built under our project bin\Debug directory so the other directory search is odd. Which raises my second question:

Are there symptoms in the Fusion log that we're overlooking?

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:

Solutions or troubleshooting tips for this version build conflict?

Many thanks in advance. Sorry for the length.

As promised the build failure:

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.

And the build version conflict excerpt:

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
like image 374
Brittain Avatar asked Dec 14 '22 23:12

Brittain


2 Answers

You need to remove the SecurityTransparent attribute from the end of the AssemblyInfo.cs file.

like image 50
Swati Gaur Avatar answered Mar 16 '23 00:03

Swati Gaur


I had the same issue when upgrading my Visual Studio 2010 VSTO projects to Visual Studio 2013. The way I fix the issue was with a combination of two things:

First I removed the reference to the assembly attribute SecurityTransparent from my AssemblyInfo.vb

<Assembly: SecurityTransparent()>

Second I set Copy Local = true on the Microsoft.Office.Tools.Common.v4.0.Utilities reference.

like image 33
Ovi Avatar answered Mar 16 '23 00:03

Ovi