如何解决此错误,“基类“Microsoft.Office.Tools.Ribbon.RibbonCollectionBase”无法设计”

发布于 2024-11-29 03:28:00 字数 783 浏览 0 评论 0原文

每当我尝试将新功能区添加到 Excel 2010 插件项目中时,我都会收到以下警告消息

无法显示此文件的设计器,因为没有 可以设计其中的类。设计师考察了 文件中的以下类:

Ribbon2 --- 无法设计基类“System.Object”。 ThisRibbonCollection --- 基类

“Microsoft.Office.Tools.Ribbon.RibbonCollectionBase”不能 设计。

另外,如果我们查看 Ribbon1.Designer.cs 中的代码,错误会指向这一行:

base.Dispose(disusing);

我不知道那里出了什么问题。我在这里缺少任何其他 Office 程序集吗?

(在我的项目中,我有 Microsoft.Office.CoreMicrosoft.Office.Interop.ExcelMicrosoft.Office.ToolsMicrosoft.Office.Tools.CommonMicrosoft.Office.Tools.ExcelMicrosoft.Office.Tools.Common.v4.0.UtilitiesMicrosoft.Office.Tools.v4.0.Framework

任何人都可以帮忙吗?谢谢。

Whenever I try to add a new ribbon into my Excel 2010 addin project, I get the following warning message

The designer could not be shown for this file because none of the
classes within it can be designed. The designer inspected the
following classes in the file:

Ribbon2 --- The base class 'System.Object' cannot be designed.
ThisRibbonCollection --- The base class

'Microsoft.Office.Tools.Ribbon.RibbonCollectionBase' cannot be
designed.

Also, if we view the code in Ribbon1.Designer.cs, the error is pointing to this line:

base.Dispose(disposing);

I have no idea what went wrong there. Am I missing any other Office assemblies here?

(in my project I have got Microsoft.Office.Core, Microsoft.Office.Interop.Excel, Microsoft.Office.Tools, Microsoft.Office.Tools.Common, Microsoft.Office.Tools.Excel, Microsoft.Office.Tools.Common.v4.0.Utilities, Microsoft.Office.Tools.v4.0.Framework)

Can anyone help? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

一抹淡然 2024-12-06 03:28:00

我也遇到了这个。我发现这是因为在创建功能区菜单之前我已将 Addin 项目的目标框架更改为完整框架。

一旦我将目标更改回客户端配置文件,我就能够创建功能区,然后我只需将其切换回完整框架(这对于我们正在做的事情是必要的),一切都很好。

I ran into this as well. What I found was it was becuase I had changed the target framework of the Addin project to the full framework before I created the ribbon menu.

Once I changed the target back to the Client Profile I was able to create the ribbon, then I just switched it back to the full framework (which was necessary for what we were doing) and all was well.

薯片软お妹 2024-12-06 03:28:00

嗯,似乎 VS2010 会有点奇怪,除非我们遵循一定的添加项目的顺序。无论如何,我所做的是我必须重新创建一个新的空白解决方案,首先添加 Excel Addin 项目,添加 Ribbons,然后添加我的类库项目以完成整个项目导入。现在运行良好。

仍然不确定为什么如果我们先添加类库它会抛出错误。我想这可能与访问程序集有关。

Hmm it seems that VS2010 somehow will be a bit quirky unless we follow a certain order of adding projects. Anyway, what I did was that I had to recreate a new blank solution, add Excel Addin project first, add Ribbons, and then add my class library project to complete the whole project import. And it is working fine now.

Still not sure why it throws errors if we add class library first. I guess perhaps it might have something to do with accessing assemblies.

浅紫色的梦幻 2024-12-06 03:28:00

这可能听起来很奇怪,但对我有用。
我尝试在VS2012中打开表单的UI设计器(使用TFS进行源代码控制),但它会给出错误:“无法设计基类system.object”。我有一个基类 FormCommon,在检查文件后将其替换为默认 Form。然后进行了干净的构建,显然失败了。我撤消了签出并打开了 UI 设计器,它工作正常。
但我不确定这个问题的根本原因是什么。

This may sound strange but worked for me.
I tried to open UI designer for a form (using TFS for source control) in VS2012 but it would give error: "base class system.object can not be designed". I had a base class FormCommon which I replaced with default Form after checking it files. Then did clean build, which obviously failed. I undone the check out and opened UI designer it worked fine.
I am not sure what is root cause of this problem though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文