VS 2010和FindRibbons构建错误 [英] build error with VS 2010 and FindRibbons

查看:94
本文介绍了VS 2010和FindRibbons构建错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有VS 2010、2012和2013。我从svn获得了一个现有项目,因此以前从未在我的机器上使用过。尝试编译时,出现以下错误

I have VS 2010, 2012 and 2013. I got an existing project from svn so it has never been on my machine before. When I tried to compile, I got the following error

The "FindRibbons" task could not be loaded from the assembly            
'Microsoft.VisualStudio.Tools.Office.BuildTasks, 
Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  Confirm that the   
<UsingTask> declaration is correct, that the assembly and all its dependencies are   
available, and that the task contains a public class that implements   
Microsoft.Build.Framework.ITask.

我发现有几条帖子提到要去

I found several posts mentionning to go to

C:\程序文件
(x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools

,打开Microsoft.VisualStudio.Tools.Office.targets
,并将所有10.0.0.0替换为我所做的12.0.0.0

, open the Microsoft.VisualStudio.Tools.Office.targets and replace all 10.0.0.0 with 12.0.0.0 which I did

,但随后出现以下错误

The "FindRibbons" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.


推荐答案

这很可能是DLL地狱问题,您在GAC中安装了错误版本的Microsoft.VisualStudio.Tools.Office.BuildTasks.dll。它缺少 FindRibbons类

This is pretty likely to be a DLL Hell problem, you have the wrong version of Microsoft.VisualStudio.Tools.Office.BuildTasks.dll installed in the GAC. It is missing the FindRibbons class.

对此有一个不俗的解释,VS2012的早期预览版部署了该类缺少的DLL版本。在此MSDN论坛线程。提出与您已经尝试过的相同解决方法,而不是解决方案。否则,提醒您永远不要在需要完成工作的计算机上安装Visual Studio的Beta版。

There is a half-decent explanation for that, an early preview edition of VS2012 deployed a version of this DLL that was missing the class. Discussed in this MSDN forums thread. Proposes the same workaround you already tried, not a solution. Otherwise a reminder to never install beta versions of Visual Studio on a machine you need to get your job done.

由于MSDN文档说该类,该问题特别令人困惑仅适用于VS2012及更高版本,不适用于VS2010。并且在安装VS2013时,必须有一个< bindingRedirect> 可以将版本10.0.0.0和11.0.0.0转发到12.0.0.0。不知道在哪里,在我的机器上找不到它。

The issue is extra convoluted because the MSDN documentation says that the class is only available for VS2012 and up, not for VS2010. And there has to be a <bindingRedirect> somewhere that forwards version 10.0.0.0 and 11.0.0.0 to 12.0.0.0 when you have VS2013 installed. Not sure where, I can't find it on my machine.

不用说,这和DLL Hell一样糟糕。两种可能的解决方案:

Needless to say, this is about as bad as DLL Hell can get. Two possible solutions:


  • Visual Studio不再自动升级项目文件。但这就是您要在这种情况下发生的事情,您将需要使用VS2013工具链。使用文本编辑器编辑.csproj文件(使用记事本即可),然后将 ToolsVersion 属性更改为 12.0。

  • Visual Studio does no longer automatically upgrade project files. But that's what you want to happen in this case, you'll want to use the VS2013 tool chain. Edit the .csproj file with a text editor (Notepad will do) and change the ToolsVersion attribute to "12.0".

修复GAC并摆脱DLL的错误版本。首先,您需要一个正确的版本,然后将其复制到另一台拥有此DLL已知良好副本的计算机上。您可以使用资源管理器找到它,然后导航至C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.BuildTasks。您可能在那里有多个子目录,而对于VS2013,我只有一个。 12.0子目录中的DLL的日期为2014年8月7日,长度为102,688字节。您可以使用Reflector或ILSpy这样的反编译器再次检查它是否包含FindRibbons类。

Get the GAC fixed and get rid of the bad version of the DLL. You'll need a proper version first, copy it off another machine that has a known-good copy of this DLL. You can find it with Explorer, navigate to C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.BuildTasks. You probably have multiple subdirectories there, I only have one for VS2013. The DLL in the 12.0 subdirectory is dated 8/7/2014 and is 102,688 bytes long. You can use a decompiler like Reflector or ILSpy to double check that it contains the FindRibbons class.

没有一个解决办法是重新安装所有内容。修复损坏的原始来源仍然很重要,如果确实在该计算机上装有VS2012的早期版本,则很难做到。运行setup.exe / uninstall / force确实可以消除它。祝你好运,从来没有一个有趣的问题可以解决。
-

A desperation move if none of this works out is to re-install everything. Still important to get the original source of the corruption fixed, pretty hard to do if you indeed had an early version of VS2012 on that machine. Running setup.exe /uninstall /force does tend to get rid of that. Good luck with it, never a fun problem to solve. -

这篇关于VS 2010和FindRibbons构建错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆