Custom Configuration Sections

前端 未结 5 2421
暖寄归人
暖寄归人 2021-02-20 14:34

I am currently trying to implement a Custom Configuration Section in a project I am busy with and no matter what I try I keep getting the error below:

{\"An error occurr

5条回答
  •  执笔经年
    2021-02-20 14:45

    So it turns out that when you create a project in Visual Studio, it automatically defines a root namespace (the name of the project by default) for the project. Thus you must include that root namespace in the section type as well as any custom namespaces you defined within your settings class.

    For example, in the case of the original poster a working configuration for them may have looked something like this:

    Where ROOT_NAMESPACE and NAME_OF_ASSEMBLY are defined in the project properties as shown in this snapshot of my project.

    assembly name and root namespace visual studio

    In my particular case, I did not explicitly define namespaces in my project. Thus my section configuration setting just had the root namespace, the name of the settings class, and the name of the assembly, as such;

    I know its a couple years late, but I hope it keeps somebody else from spending hours on this like I did.

提交回复
热议问题