开发者

How to solve this error, "The base class 'Microsoft.Office.Tools.Ribbon.RibbonCollectionBase' cannot be designed"

开发者 https://www.devze.com 2023-03-27 12:00 出处:网络
Whenever I try to add a new ribbon into my Excel 2010 addin project, I get the following warning message

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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号