一个通过VSTO Excel功能区解决方案资源管理器中的文件夹结构与路径code文件夹、路径、资源管理、器中

2023-09-05 23:53:29 作者:别为昨天哭泣昨天已成回忆

我下面这教程通过VSTO添加Excel功能区。 我的问题是完全一样的this一。我曾经访问过的链接,但它并没有帮助我。答案是很差,让我在如何解决这一问题方面毫无章法。 如果我直接添加一个功能区项目的项目,我能够编译并运行加载项。然而,当我添加一个新的文件夹,然后坚持一个新的项目(功能区)内的文件夹中,我得到一个错误。我认为这是关系到path'ing。 某处,不知何故,我已经了解到的Visual Studio 2012采用的智能文件夹结构的(对不起,这个可怜的命名),这意味着它会在默认目录等文件,如果你改变了结构,那么你必须编辑文件(我不知道哪一个),并指定给它的新路径。我怀疑上面是问题。 解决方案资源管理器中的文件夹结构: 错误信息:

 > 'MyAddIn.Ribbon.ThisRibbonCollection'不包含一个定义
>对于GetRibbon',没有扩展方法'GetRibbon接受第一
>类型'MyAddIn.Ribbon.ThisRibbonCollection的说法可以发现
> (是否缺少using指令或程序集引用?)
 

在code:

 部分类ThisRibbonCollection
{
    内部MyCustomRibbon MyCustomRibbon
    {
        {返回this.GetRibbon< MyCustomRibbon>(); }
    }
}
 

我的问题是:什么code我必须修改(?命名空间)以点带面的部分类到正确的位置

解决方案

哈!我刚刚意识到有一个很简单变通解决这个问题。我相信还有其他的方法,可能更复杂,需要编码,来解决这个问题,但为什么要复杂化你的生活摆在首位? :)我认为这个解决方案通常适用于任何拥有类似的问题。 我记得读的 ASP.NET 4.5在C#和VB.NET 的。笔者向您介绍了Visual Studio的很详细,并说明了如何使用的 解决方案Exlorer 的。我意识到这是可能的,在Solution Explorer中移动文件时的Visual Studio将自动更新所有的 引用 我们。 我能够编译并运行该项目时,我添加的文件直接到项目作为一个新的项目(功能区[可视化设计器])。当我叫项目解决方案创建一个新的文件夹中的丝带的,然后右键点击,增加了一个新的项目,我得到错误。因此,而不是添加新文件到的丝带的文件夹,我把它添加直接到项目,然后简单地把它拖到了的丝带的文件夹中。嘘!该项目已编译并运行没有错误! 我不能相信我没有在第一时间想到的是 - >我想我得到了太得意忘形之后的教程 ... 步骤: 添加一个名为 丝带 的:新的文件夹 右键点击MyExcelAddIn>和新项目的 丝带 的(可视化设计) 拖放的 myRibbon.cs 的到的 丝带 的文件夹 编译和运行!享受

怎么删除资源管理器文件夹 删除文件资源管理器方法 系统城

I am following this tutorial for adding an Excel Ribbon via VSTO. My problem is exactly the same as this one. I have visited the links, but it didn't help me. The answer is very poor and leaves me clueless in terms of how to solve this issue. If I add a Ribbon Item straight to the Project I am able to compile and run the add-in. However, when I add a new folder then stick a new item(Ribbon) inside of that folder I am getting an error. I think it's related to the path'ing. Somewhere, somehow I have learned that Visual Studio 2012 uses an intelligent folder structure (sorry for this poor naming) which means that it looks for files in default directories etc. If you change the structure then you have to edit a file(i dont know which one) and specify your new path to it. I am suspecting the above to be the issue. Solution Explorer folder structure: The error msg:

> 'MyAddIn.Ribbon.ThisRibbonCollection' does not contain a definition
> for 'GetRibbon' and no extension method 'GetRibbon' accepting a first
> argument of type 'MyAddIn.Ribbon.ThisRibbonCollection' could be found
> (are you missing a using directive or an assembly reference?)

The code:

partial class ThisRibbonCollection
{
    internal MyCustomRibbon MyCustomRibbon
    {
        get { return this.GetRibbon<MyCustomRibbon>(); }
    }
}

My question is: What code do I have to modify (namespace?) in order to point the partial class to the right location?

解决方案

Ha! I have just realised there is a very simple work around to this problem. I am sure there are other ways, possibly more complicated and requiring coding, to solve this issue but why would you want to complicate your life in first place? :) I think this solution generally applies to anyone with a similar problem. I remember reading ASP.NET 4.5 IN C# and VB.NET. The author introduces you to the Visual Studio in great detail and explains how to use the Solution Exlorer. I realized it was possible to move files around in the Solution Explorer while Visual Studio would automatically update all references for us. I was able to compile and run the Project when I added the file straight to the Project as a new item (Ribbon[Visual Designer]). When I created a new folder in the Project Solution called Ribbon and then right-clicked and added a new item I was getting error. So, instead of adding the new file to the Ribbon folder, I added it straight to the Project and then simply dragged it to the Ribbon folder. Boo! The project compiled and ran with no errors! I can't believe I haven't thought of it in the first place -> I guess I got too carried away following the tutorial... Steps: Add a new folder called Ribbon Right click MyExcelAddIn > and a new item Ribbon (Visual Designer) Drag and drop myRibbon.cs into the Ribbon folder compile and run! Enjoy