c# - 为 Outlook 2010 构建插件时 FindRibbons 任务意外失败

标签 c# msbuild outlook-2010

我们正在使用 VS2013、.NET4、Microsoft Async 和 BCL Portability(来自 Nuget)构建 Outlook 2010 插件,遇到类似于 this question 的构建错误和 this forum discussion不幸的是,这些资源(或互联网的其余部分)都没有帮助解决我们的问题。

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

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.

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

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

最后一个症状来自详细的构建日志,我们在其中看到 mscorlib、System.Core 和其他几个库之间存在冲突。这些依赖项通过 Bcl 等进入,4.0.0.0 与 2.0.5.0 的冲突似乎会阻止构建或生成 FileNotFoundException。我们尝试了一些具有绑定(bind)重定向等的补救措施,但无法完成这项工作。最后一个问题:

Solutions or troubleshooting tips for this version build conflict?

非常感谢。对不起,长度。

正如所 promise 的构建失败:

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

最佳答案

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

关于c# - 为 Outlook 2010 构建插件时 FindRibbons 任务意外失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23505938/

相关文章:

vba - Outlook 2010 自定义 VBA 脚本将传入的邮件消息移动到特定文件夹

html - 如何在 outlook 2010 html 邮件中显示背景颜色?

c# - 让 Akka.NET 连接到远程地址

c# - Twitter Streaming API .NET 库

visual-studio - msbuild 14.0 属于哪个版本的 Visual Studio?

tfs - 我应该在哪里存储团队 build 的共同目标?

c# - Linq根据另一个列表查询对象列表的结果

c# - 反射器和编译器生成的代码

msbuild - 使用 MSBuild FileUpdate 任务仅更改 AssemblyInfo.cs 中的修订号

visual-studio-2010 - 将自定义按钮添加到 Outlook 2010 和 2013 中的现有功能区