none
Error while adding a new sheet in VS designer in a VSTO Excel project RRS feed

  • Question

  • Hi All,

    When I try to add a new sheet in my existing (VSTO Excel, VSTO 4.0 C# application with Office 2010) project from Visual Studio. It add successfully but when I compile it throws the below error:

    “Partial declarations of 'NameSpace.Globals' have conflicting accessibility modifiers wsSheet1.Designer.cs”

    I’ve read lots of articles about “Partial class and its accessibility modifier”, but not able to find its fix in that Designer.cs.

    Due to this I’m not able to proceed with new sheet in the project.

    Thanks a lot in advance.

    Utshek Jain


    Thanks Utshek Jain

    Tuesday, July 8, 2014 12:32 PM

Answers

  • Hi Utshek,

    From the error message, it seems that the accessibility of the 'NameSpace.Globals' class is inconsistent among different [sheet_xyz].designer.cs.

    For example:

        public sealed partial class Globals {
            
        }
    
        internal sealed partial class Globals {
            
        }

    Please find the inconsistent declaration according to compiler error and change it to default (“internal”), and let me know whether this issue is resolved.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 16, 2014 5:34 AM
    Moderator

All replies

  • Hello Utshek,

    Do you develop an application level or document-level add-in?

    Tuesday, July 8, 2014 12:43 PM
  • It's document-level customization, for Excel based tool, it has also ribbon control for each tabs.

    Thanks Utshek Jain


    • Edited by Utshek Tuesday, July 8, 2014 12:52 PM
    Tuesday, July 8, 2014 12:45 PM
  • What type file did you add to the add-in?

    Make sure that both partial class definitions have the "partial" keyword in their declaration.

    Tuesday, July 8, 2014 12:55 PM
  • Its giving me error at very first line of below code from my Designer.cs. i didn't found its any other class having the same name as Globals. I've approx 20 sheets in my workbook

    internal sealed partial class Globals {
           
            private static wsSheetNew _wsSheetNew;
           
            internal static wsSheetNew wsSheetNew {
                get {
                    return _wsSheetNew;
                }
                set {
                    if ((_wsSheetNew == null)) {
                        _wsSheetNew = value;
                    }
                    else {
                        throw new System.NotSupportedException();
                    }
                }
            }
        }


    Thanks Utshek Jain

    Tuesday, July 8, 2014 12:59 PM
  • Hi Utshek,

    From the error message, it seems that the accessibility of the 'NameSpace.Globals' class is inconsistent among different [sheet_xyz].designer.cs.

    For example:

        public sealed partial class Globals {
            
        }
    
        internal sealed partial class Globals {
            
        }

    Please find the inconsistent declaration according to compiler error and change it to default (“internal”), and let me know whether this issue is resolved.

    Regards,

    Jeffrey


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 16, 2014 5:34 AM
    Moderator